php - PHPStorm is not recognizing methods of my Model class in Laravel 5.0 -


failed insert data database, , query class , model class's method not found show in ide (phpstrom) how can solve it?

here extended class (post.php) here show error in latest , method:

<?php namespace app;  use carbon\carbon; use illuminate\database\eloquent\model;  class post extends model {      protected  $fillable=[         'title',         'description',         'location',         'contact',         'type',         'published_at'     ];     protected $date=['published_at'];     public function setpublishedatattribute($date)     {         $this->attributes['published_at'] = carbon::createfromformat('y-m-d', $date);     }      /**      * @param $query      */     public function scopepublished($query)     {         $query->where('published_at', '<=', carbon::now());     }      public function scopeunpublished($query)     {         $query->where('published_at', '>=', carbon::now());     }      /**      * post owned user.      * @return \illuminate\database\eloquent\relations\belongsto      */     public function user(){         return $this->belongsto('app\user');     }  }  

and here controller class use :

<?php namespace app\http\controllers;  use app\http\requests;  use app\http\requests\createpostrequest; use app\post; use request; use illuminate\support\facades\auth; use session;  class postscontroller extends controller {      //     public function __construct()     {         $this->middleware('auth');     }      public function index()     {         //return \auth::user()->name;         $posts = post::latest('published_at')->published()->get();         $latest= post::latest()->first();         return view('tolet.index', compact('posts','latest'));      }      /**      * @param post $post      * @return \illuminate\view\view      * @internal param articles $article      * @internal param articles $articles      */     public function show(post $post)     {          return view('tolet.show', compact('post'));     }      public function create()     {         if (auth::guest()) {             return redirect('tolet.index');         }         return view('tolet.create');     }      /**      * @param createpostrequest $request      * @return \illuminate\http\redirectresponse|\illuminate\routing\redirector      */     public function store(createpostrequest $request)     {         //validation          $this->createpost($request);          // flash('your tolet has been created!')->important();          return redirect('tolet.index');     }      /**      * @param post $post      * @return \illuminate\view\view      * @internal param articles $article      */     public function edit(post $post)     {         return view('tolet.edit', compact('post'));     }       /**      * @param post $post      * @param createpostrequest $request      * @return \illuminate\http\redirectresponse|\illuminate\routing\redirector      * @internal param articles $article      * @internal param $id      */     public function update(post $post, createpostrequest $request)     {         $post->update($request->all());         return redirect('tolet.index');     }      /**      * sync list of tags in database      *      * @param post $post      */       /**      * save new post      *      * @param createpostrequest $request      * @return mixed      */     private function createpost(createpostrequest $request)     {         $post = auth::user()->posts()->create($request->all());          return $post;     }   } 

since methods where, latest, find, findorfail , others not exist in model class, in builder , loaded via magic methods, ide can not detect these.

while suggested laravel-ide-helper great, does not help also. there multiple issues , discussions , workarounds on subject, have own problems.

best solution i've found far, imho downgrade severity if __magic methods present in class. phpstorm has exact option in inspections settings.

check in settings -> inspections -> php -> undefined -> undefined method not let click on method, merely disables annoying markup. read more severities or check more expressive answer


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -