芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/www/app/Models/User.php
'datetime', ]; /** * The accessors to append to the model's array form. * * @var array */ protected $appends = [ 'profile_photo_url', ]; public function isAdmin(){ if($this->role != NULL) { if ($this->role->name == "administrator") { return true; } } return false; } public function isAuthor(){ if($this->role != NULL) { if ($this->role->name == "author" || $this->role->name == "administrator") { return true; } } return false; } public function role(){ return $this->belongsTo('App\Models\Role'); } public function photo(){ return $this->belongsTo('App\Models\Photo', 'photo_id'); } public function posts(){ return $this->hasMany('App\Models\Post'); } public function pages(){ return $this->hasMany('App\Models\Page'); } public function projects(){ return $this->hasMany('App\Models\Project'); } }