public function insert() { $this->checker('update_full_admin'); if (Session::get('csrf') != Helper::post('_csrf')) { Router::redirect('home.index'); } $name = Helper::post('name'); $description = Helper::post('description'); $group = Groups::select()->where('name', $name)->get(); if (!empty($group) || empty($name) || empty($description)) { Router::redirect('home.index'); } $group = Groups::create(); $group->name = $name; $group->description = $description; $group->auth_site = '' . $this->calculBinaryRight('site'); $group->auth_news = '' . $this->calculBinaryRight('news'); $group->save(); Router::redirect('admin:group.show'); }
public function postGroups(FormGroupsRequest $request) { if (!empty($request)) { $data = $request->all(); $data['customer_id'] = Auth::customer()->user()->id; $data['flagactive'] = $request->get('flagactive', 1); if ($request->id) { $obj = Groups::find($request->id); $obj->update($data); } else { $obj = Groups::create($data); } return array('msg' => 'ok', 'state' => 1, 'data' => null); } return array('msg' => 'Error al guardar el modelo', 'state' => 0, 'data' => null); }