public function store(Request $request)
 {
     $flag = 1;
     $ChekPubli = '0';
     if ($request['ChekPublicar'] == 'on') {
         $ChekPubli = '1';
     }
     $ChekPrivad = '0';
     if ($request['ChekPrivado'] == 'on') {
         $ChekPrivad = '1';
     }
     $orderBy = DB::table('cms_documents')->where('active', '=', $flag)->max('order_by') + 1;
     $file = $request->file('file');
     if ($file != "") {
         $file = $request->file('file');
         $path = 'store/DOC/' . 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_documents';
     $uri = $this->validateFriendlyUri($uri, $table);
     \App\cms_document::create(['id_category' => $request['id_category'], 'title' => $request['title'], 'resumen' => $request['resumen'], 'content' => $request['content'], 'main_picture' => $path, 'private' => $ChekPrivad, 'publish_date' => $request['publish_date'], 'publish' => $ChekPubli, 'hits' => '0', 'uri' => $uri, 'order_by' => $orderBy, 'active' => '1', 'register_by' => Auth::User()->id, 'modify_by' => Auth::User()->id]);
     Session::flash('message', 'Documento creado con exito');
     return redirect('admin/document');
 }