php - Laravel throwing parse error whenever model is referenced in Controller -
i have pretty major problem code. whenever reference model in controller, laravel throws parse error. have gone through code many times, , not see grammatical problems or anything. anyway, here code:
<?php class casecontroller extends basecontroller{ public function index() { $cases = case::all(); return view::make('index', compact('cases')); } public function create(){ return view::make('create'); } public function handlecreate(){ $case = new case; $case->name= input::get('name'); $case->value= input::get('value'); $case->contentions= input::get('contentions'); $case->notes= input::get('notes'); $case->side= input::get('side'); $case->save(); } }
here eloquent model:
<?php class case extends eloquent{ }
the parse error thrown on line:
$cases = case:all();
however, when erase line
$cases = case:all();
the parse error thrown on line:
$case = new case;
it seems whenever mention model case in code, laravel throws parse error.
any appreciated. thank you!
case
is reserved word used in switch statements, example:
switch($a) { case 'foo': $b = true; break; case 'bar': $b = false; break; default: die('not found!'); }
you going need rename class different. when initializing class, proper syntax is:
$case = new case(); // instead of: // $case = new case;
Comments
Post a Comment