0
ちょっと私はforeachループを使用してコードを作成していますが、無効な引数のエラーが出ます。モデルを使用しているforeachループの引数が無効
私のコードのループが
public function handle($request, Closure $next)
{
foreach(Auth::user()->User as $role){
if($role->role == 'doctor')
{
return $next($request);
}
}
return redirect('');
}
され、モデルが
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
}
である私が間違っているのを教えてください。