php - Eloquent method all() undefined -


hi learning laravel. facing problem. seems eloquent method not inherited properly. when tried fetch data table in controller index method, shows "call undefined method category::all()" .. irritating never faced before did code earlier in similar way. pasted code below. experts need ur attention pls.

model:

<?php  class category extends \eloquent {     //protected $fillable = [];      protected $table = 'categories';      public static function getcategory($category){          $category->category = $category['category'];         $category->save();      } } 

controller:

public function index() {     // inputs     $categories = category::all();      // load view , pass inputs     return view::make('manage-category')         ->with('categories', $categories); } 

views:

<div class="col-md-4">     <select name='category' class="table-group-action-input form-control" name="product[status]">         <option>select</option>         @if( isset($categories))             @foreach($categories $categories)                 <option value="{{ $categories->id }}">{{ $categories->category }}</option>             @endforeach         @endif     </select> </div> 

routes:

route::get('/manage-category','categorycontroller@index'); 

most composer autoload definition outdated , hence controller not finding class category. should try running composer dump-autoload command project directory , see whether fixes issue, before investigating more.

please note, laravel 4 doesn't autoload models (or non-controller library classes added later), every time adding model class in project, have run composer dump-autoload command project directory.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -