public function store(Request $request) { $ChekPubli = '0'; if ($request['ChekPublicar'] == 'on') { $ChekPubli = '1'; } $ChekPrivad = '0'; if ($request['ChekPrivado'] == 'on') { $ChekPrivad = '1'; } $flag = 1; $orderBy = DB::table('cms_sections')->where('active', '=', $flag)->max('order_by') + 1; $file = $request->file('file'); if ($file != "") { $path = 'store/SEC/' . uniqid() . '.' . $file->getClientOriginalExtension(); //indicamos que queremos guardar un nuevo archivo en el disco local Storage::disk('local')->put($path, File::get($file)); } else { $path = ""; } $uri = str_replace(" ", "-", trim($request['title'])); //Obtenemos la uri en base al titulo $uri = $this->string2url($uri); // //Generamos una Uri única $table = 'cms_sections'; $uri = $this->validateFriendlyUri($uri, $table); \App\cms_section::create(['id_type' => $request['id_type'], 'title' => $request['title'], 'resumen' => $request['resumen'], 'content' => $request['content'], 'main_picture' => $path, 'private' => $ChekPrivad, 'publish_date' => $request['publish_date'], 'publish' => $ChekPubli, 'uri' => $uri, 'order_by' => $orderBy, 'active' => '1', 'register_by' => Auth::User()->id, 'modify_by' => Auth::User()->id]); return redirect('admin/sections'); }
public function store(Request $request) { \App\cms_section::create(['id_type' => '2', 'title' => $request['titulo'], 'resumen' => $request['resumen'], 'content' => $request['contenido'], 'main_picture' => 'imagen', 'private' => $request['privado'], 'publish_date' => '2015/03/03', 'publish' => $request['publico'], 'uri' => 'cadena', 'order_by' => '1', 'active' => '1', 'register_by' => '1', 'register_date' => '2015/02/02', 'modify_by' => '1', 'modify_date' => '2015/03/03', 'register_by' => '1']); return "section registrado"; }