Esempio n. 1
0
 /**
  * Show the profile for the given user.
  *
  * @param  int  $id
  * @return Response
  */
 public function listDashboard()
 {
     $page_title = "Dashboard";
     $title = "Admin - Dashboard";
     $m_articles = m_articles::all();
     $count_art = number_format($m_articles->count());
     $m_user = m_user::all();
     $count_user = number_format($m_user->count());
     $m_gallery = m_gallery::all();
     $count_gallery = number_format($m_gallery->count());
     return view('backend.formdashboard', ['title' => $title, 'page_title' => $page_title, 'count_art' => $count_art, 'count_user' => $count_user, 'count_gallery' => $count_gallery]);
 }
Esempio n. 2
0
 public function updateArt(Request $request)
 {
     $artid = Input::get('txt_artid');
     $image = Input::file('txt_thumb');
     $thumb = '';
     if ($image) {
         $file = array('txt_thumb' => Input::file('txt_thumb'));
         $validator = Validator::make($file, $this->rules_thumb);
         $validator->setAttributeNames(array('txt_thumb' => 'Thumbnail'));
         if ($validator->fails()) {
             return redirect('art/ediArt/' . $artid)->withErrors($validator)->withInput();
         }
         $destinationPath = config('myconfig.upload_folder_images');
         $filename = $image->getClientOriginalName();
         $fullname = date('dmYHis') . '.' . $filename;
         $green = $image->move($destinationPath, $fullname);
         $thumb = $destinationPath . '/' . $fullname;
         //Delete old file
         if (Input::has('txt_thumb_old')) {
             File::delete(Input::get('txt_thumb_old'));
         }
     }
     $validator = Validator::make($request->all(), $this->rules);
     $validator->setAttributeNames($this->niceNames);
     if ($validator->fails()) {
         return redirect('art/editArt')->withErrors($validator)->withInput();
     }
     $art = m_art::find($artid);
     $art->title = Input::get('txt_title');
     $art->summary = Input::get('txt_summ');
     $art->content = Input::get('txt_content');
     $art->status = Input::get('cb_status');
     $art->catid = Input::get('cb_cat');
     $art->chby = Session::get('usrid');
     $art->slug = str_slug(Input::get('txt_title'), '-');
     $art->id_gallery = Input::get('txt_galleryid');
     $art->tag = Input::get('txt_tag');
     if ($image) {
         $art->thumb = $thumb;
     }
     if ($art->save()) {
         return Redirect::to('art/listArt')->with('success', 'Article was updated successfully!');
     }
 }