30 lines
744 B
PHP
30 lines
744 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ChaosEvents extends Model
|
|
{
|
|
protected $table = 'chaos_events';
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'from_date_internal' => 'date',
|
|
'to_date_internal' => 'date',
|
|
'from_date_visible' => 'date',
|
|
'to_date_visible' => 'date',
|
|
];
|
|
}
|
|
|
|
public function preApplications() {
|
|
return $this->hasMany('App\Models\PreApplications', 'event_id');
|
|
}
|
|
|
|
public static function getActiveEvents(){
|
|
return self::where('active', 1)->where('to_date_internal', '>=', today())
|
|
->where('from_date_internal', '<=', today())->orderBy('to_date_internal')->get();
|
|
}
|
|
}
|