%PDF- %PDF-
Direktori : /var/www/html/camillo/camillo-api-master/app/Models/ |
Current File : /var/www/html/camillo/camillo-api-master/app/Models/Schoolyear.php |
<?php namespace App\Models; use App\Scopes\SchoolyearScope; use App\User; use Illuminate\Database\Eloquent\Model; use Watson\Validating\ValidatingTrait; class Schoolyear extends Model { use ValidatingTrait; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'institute_id', 'start_date', 'end_date', 'description', 'created_by', 'updated_by' ]; protected $dates = [ 'created_at', 'updated_at', 'start_date', 'end_date' ]; protected $rules = [ 'institute_id' => 'required|integer|exists:institutes,id', 'start_date' => 'required|date', 'end_date' => 'required|date', 'description' => 'required|string' ]; protected static function boot() { parent::boot(); static::addGlobalScope(new SchoolyearScope); } /** * Validation messages to be passed to the validator. * * @var array */ protected $validatingMessages = []; /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function institute() { return $this->belongsTo(Institute::class); } /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function festivities() { return $this->hasMany(Festivity::class); } /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function classrooms() { return $this->hasMany(Classroom::class); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function creator() { return $this->belongsTo(User::class); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function updater() { return $this->belongsTo(User::class); } /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function events() { return $this->hasMany(Event::class); } }