Example #1
0
 public function store_home_set(Request $request)
 {
     $path = '/uploads/logo/';
     if ($request->hasFile('logo')) {
         $logo = $request->file('logo');
         if ($logo != null && $logo->isValid()) {
             $clientName = $logo->getClientOriginalName();
             $extension = $logo->getClientOriginalExtension();
             $fileName = md5(date('ymdhis') . $clientName) . "." . $extension;
             $destinationPath = public_path() . $path;
             $logo->move($destinationPath, $fileName);
             $logo_path = $path . $fileName;
             $title = Input::get('WebTitle');
             $describtion = Input::get('Webdescription');
             $System = new System();
             $first = $System->first();
             if ($first->count() == 0) {
                 $System->title = $title;
                 $System->webdescription = $describtion;
                 $System->logo = $logo_path;
                 $System->save();
                 return Redirect::back()->withErros(Null);
             } else {
                 $first->title = $title;
                 $first->webdescription = $describtion;
                 $first->logo = $logo_path;
                 $first->save();
                 return Redirect::back()->withErros(Null);
             }
             return Redirect::back()->withErros(Null);
         }
     } else {
         $title = Input::get('WebTitle');
         $describtion = Input::get('Webdescription');
         $System = new System();
         $first = $System->first();
         if ($first->count() == 0) {
             $System->title = $title;
             $System->webdescription = $describtion;
             $System->save();
             return Redirect::back()->withErros(Null);
         } else {
             $first->title = $title;
             $first->webdescription = $describtion;
             $first->save();
             return Redirect::back()->withErros(Null);
         }
     }
 }