Laravel 4 - Method [where] does not exist -


i trying row table "->find(x)" or "->where" error in return. guess missing can't tell what.

<?php  class snippetscontroller extends basecontroller {      public $restful = true;      public function index($id)     {         $snippet = snippetscontroller::where('id', '=', 11)->get(); 

i tried find noting helps.

    $snippet = snippetscontroller::find(11); 

with "->get" , without. noting works. have "11" id in table , error seems have noting it.

maybe need extend class eloquent? if so, how keep basecontroller on top of it?

thanks!

error:

badmethodcallexception method [find] not exist.

you must have model called snippet, right? how use it:

$snippet = snippet::find(11); 

your snippetscontroller not tied database (eloquent orm), must create (if don't have already) model:

class snippet extends eloquent {  } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -