You are confusing things, you SHOULD pass variables to the view IN the controller and then use them in the view (as of your line 12th)
To use that variable in the view, you should pass it in the controller: i.e:
publix function index(){
$user = User::find(1);
return view('index',['user'=>$user]); //'user' is the name of the variable in the view and $user the value that variable will take
}
Then you can use {{$user->id}}
the "use AppModelsUser;" syntax should only be used on Controllers or PHP classes, if you indeed need to use the actual model in view (in a loop for example) you can achieve that also!
@foreach(AppModelsUser::all() as $user)
<!-- html code -->
@endforeach
<!-- OR -->
{{ AppModelsUser::find(104)->name }}
Hope it helped!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…