在User.php model中新增一個function,在裡面呼叫belongsToMany的方法,可以讓user找到對應的role。 public function roles(){ return $this->belongsToMany('App\Role'); }.
確定! 回上一頁