/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $nuevo = new Marca(); // Preparamos un registro vacio para la tabla Local $nuevo->nombre_marca = $request->get('nombre_marca'); $nuevo->save(); return \Response::json(array('datos' => Marca::all())); }
/** * Creates a new Marca model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Marca(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }