%PDF- %PDF-
Direktori : /var/www/html/camillo/camillo-api-master/app/Models/ |
Current File : /var/www/html/camillo/camillo-api-master/app/Models/Institute.php |
<?php namespace App\Models ; use App\Scopes\InstituteScope; use App\User; use Illuminate\Database\Eloquent\Model; use Watson\Validating\ValidatingTrait; class Institute extends Model { use ValidatingTrait; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'code', 'name', 'category', 'typology', 'city', 'province', 'zip_code', 'address', 'phone', 'email', 'active', 'created_by', 'updated_by' ]; protected $rules = [ 'code' => 'required|string', 'name' => 'required|string', 'category' => 'string', 'typology' => 'string', 'city' => 'string', 'province' => 'string', 'zip_code' => 'string|size:5', 'address' => 'string', 'phone' => 'string', 'email' => 'email|unique', 'active' => 'boolean', ]; /** * Validation messages to be passed to the validator. * * @var array */ protected $validatingMessages = []; protected static function boot() { parent::boot(); static::addGlobalScope(new InstituteScope); } /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function notices() { return $this->hasMany(Notice::class); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ public function users() { return $this->belongsToMany(User::class); } /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function events() { return $this->hasMany(Event::class); } /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function schoolyears() { return $this->hasMany(Schoolyear::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); } public function minors() { return $this->hasMany(Minor::class); } }