Symfony \ Component \ Debug \ Exception \ FatalErrorException
Cannot call constructor seguido por \app\controllers\CategoriesController.php7 les anexo una imagen
y nose que pueda ser incluyo el codigo del modelo y del controller por si puedo tener un error.
CategoriesController.php
Código:
Category.php<?php class CategoriesController extends BaseController { public function __construct() { parent::__construct(); $this->beforeFilter('csrf', array('on'=>'post')); $this->beforeFilter('admin'); } public function getIndex() { return View::make('categories.index') ->with('categories', Category::all()); } public function postCreate() { $validator = Validator::make(Input::all(), Category::$rules); if ($validator->passes()) { $category = new Category; $category->name = Input::get('name'); $category->save(); return Redirect::to('admin/categories/index') ->with('message', 'Category Created'); } return Redirect::to('admin/categories/index') ->with('message', 'Something went wrong') ->withErrors($validator) ->withInput(); } public function postDestroy() { $category = Category::find(Input::get('id')); if ($category) { $category->delete(); return Redirect::to('admin/categories/index') ->with('message', 'Category Deleted'); } return Redirect::to('admin/categories/index') ->with('message', 'Something went wrong, please try again'); } }
Código:
Agradecería mucho su ayuda! Saludos! <?php class Category extends Eloquent { protected $fillable = array('name'); public static $rules = array('name'=>'required|min:3'); public function products() { return $this->hasMany('Product'); } }