* @author James Brooks */ class Action extends Model { use ValidatingTrait; /** * A list of methods protected from mass assignment. * * @var string[] */ protected $guarded = ['_token', '_method']; /** * The relations to eager load on every query. * * @var string[] */ protected $with = ['user']; /** * The attributes that should be casted to native types. * * @var string[] */ protected $casts = [ 'id' => 'int', 'class_name' => 'string', 'user_id' => 'int', 'username' => 'string', 'information' => 'string', 'description' => 'string', ]; /** * The validation rules. * * @var string[] */ public $rules = [ 'id' => 'nullable|int|min:1', 'class_name' => 'required|string', 'user_id' => 'required|int|min:1', 'username' => 'required|string', 'information' => 'nullable|string', 'description' => 'required|string', ]; /** * Get the user relation. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function user() { return $this->belongsTo(User::class); } }