<commit_before><?php namespace Blindern\UKA\Billett;

use \Blindern\UKA\Billett\Eventgroup;
use \Illuminate\Database\Eloquent\ModelNotFoundException;
use \Henrist\LaravelApiQuery\ApiQueryInterface;

class Event extends \Eloquent implements ApiQueryInterface {
    /**
     * Get a model by its ID or alias and fail if not found
     *
     * @param string id or alias
     * @return static|null
     */
    public static function findByAliasOrFail($id_or_alias)
    {
        $ev = static::find($id_or_alias);
        if (!$ev)
        {
            $ev = static::where('alias', $id_or_alias)->first();
        }

        if (!$ev)
        {
            throw (new ModelNotFoundException)->setModel(get_called_class());
        }

        return $ev;
    }

    protected $model_suffix = '';
    protected $table = 'events';
    protected $appends = array('is_timeout', 'is_old', 'ticket_count', 'has_tickets', 'web_selling_status');
    protected $hidden = array('image');

    protected $apiAllowedFields = array('id', 'eventgroup_id', 'alias', 'is_admin_hidden', 'is_published', 'is_selling', 'time_start',
        'time_end', 'title', 'category', 'location', 'ticket_info', 'selling_text', 'max_each_person', 'max_sales', 'description',
        'description_short', 'ticket_text', 'link', 'age_restriction');
    protected $apiAllowedRelations = array('eventgroup', 'ticketgroups', 'tickets');

    /**
     * When the online selling freezes (how many seconds before event start)
     */
    const SELL_TIMEOUT = 3600;

    public function eventgroup()
    {
        return $this->belongsTo('\\Blindern\\UKA\\Billett\\Eventgroup'.$this->model_suffix, 'eventgroup_id');
    }<commit_msg>Allow tickets to be sold till the event start<commit_after><?php namespace Blindern\UKA\Billett;

use \Blindern\UKA\Billett\Eventgroup;
use \Illuminate\Database\Eloquent\ModelNotFoundException;
use \Henrist\LaravelApiQuery\ApiQueryInterface;

class Event extends \Eloquent implements ApiQueryInterface {
    /**
     * Get a model by its ID or alias and fail if not found
     *
     * @param string id or alias
     * @return static|null
     */
    public static function findByAliasOrFail($id_or_alias)
    {
        $ev = static::find($id_or_alias);
        if (!$ev)
        {
            $ev = static::where('alias', $id_or_alias)->first();
        }

        if (!$ev)
        {
            throw (new ModelNotFoundException)->setModel(get_called_class());
        }

        return $ev;
    }

    protected $model_suffix = '';
    protected $table = 'events';
    protected $appends = array('is_timeout', 'is_old', 'ticket_count', 'has_tickets', 'web_selling_status');
    protected $hidden = array('image');

    protected $apiAllowedFields = array('id', 'eventgroup_id', 'alias', 'is_admin_hidden', 'is_published', 'is_selling', 'time_start',
        'time_end', 'title', 'category', 'location', 'ticket_info', 'selling_text', 'max_each_person', 'max_sales', 'description',
        'description_short', 'ticket_text', 'link', 'age_restriction');
    protected $apiAllowedRelations = array('eventgroup', 'ticketgroups', 'tickets');

    /**
     * When the online selling freezes (how many seconds before event start)
     */
    const SELL_TIMEOUT = 0;

    public function eventgroup()
    {
        return $this->belongsTo('\\Blindern\\UKA\\Billett\\Eventgroup'.$this->model_suffix, 'eventgroup_id');
    }
{'fraction_non_alphanumeric': 0.13904370783220885, 'fraction_numerical': 0.0014667057788207685, 'mean_word_length': 3.343949044585987, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4486535', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1042, 'n_words': 238}