php - I can't use my User model in my view -


i trying peform method such getusername() in foreach of posts gives me error:

class 'user' not found (view: /home/stackingcoder/development/php/internetstuffer/resources/views/index.blade.php) 

i have in homecontroller.php: use app\user; still doesn't work. know why?

here code of view:

 @foreach($posts $post)     <div class="container">         <div class="row">             <div class="col-md-10 col-md-offset-1">                 <div class="panel panel-default">                     <div class="panel-heading"><i class="fa fa-btn fa-message"></i>{{ $post->gettitle() }} | {{ user::find( $post->getuser_id() )->getusername() }} </div>                     <div class="panel-body">                         {{ $post->gettext() }}                     </div>                 </div>             </div>         </div>     </div> @endforeach 

@pilec says:

did try qualified name? (\app\user::find( $post->getuser_id() )->getusername())

and worked! answer, know how other models , classes!


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -