예제 #1
0
 public function about()
 {
     $about = About::all();
     $skill = Skill::all();
     $data = array('about' => $about, 'skill' => $skill);
     return view('about.index', $data);
 }
예제 #2
0
 public function aboutPageJson()
 {
     $return_array = array();
     $about = About::all();
     foreach ($about as $about) {
         $data_array['id'] = $about->id;
         $data_array['heading'] = $about->heading;
         $data_array['lead'] = $about->lead;
         $data_array['description'] = $about->description;
         array_push($return_array, $data_array);
     }
     echo json_encode($return_array);
 }
예제 #3
0
 public function createAbout(Request $request)
 {
     $aboutCount = About::count();
     if ($aboutCount == 1) {
         $about = About::find(1);
         $about->heading = $request->input('heading');
         $about->lead = $request->input('lead');
         $about->description = $request->input('description');
         if ($request->hasFile('avatar')) {
             $destinationPath = public_path('images/');
             $extension = $request->file('avatar')->getClientOriginalExtension();
             $fileName = time() . "." . $extension;
             $request->file('avatar')->move($destinationPath, $fileName);
             $about->avatars = "/images/" . $fileName;
             //File::Delete('public/'.$oldAvatar);
         } else {
             $about->avatars = $about->avatars;
         }
         //echo $about->avatar;
         $about->update();
         return Redirect::to('aboutCms');
     } elseif ($aboutCount == 0) {
         $about = new About();
         $about->heading = $request->input('heading');
         $about->lead = $request->input('lead');
         $about->description = $request->input('description');
         if ($request->hasFile('avatar')) {
             $destinationPath = public_path('images/');
             $extension = $request->file('avatar')->getClientOriginalExtension();
             $fileName = time() . "." . $extension;
             $request->file('avatar')->move($destinationPath, $fileName);
             $about->avatars = "/images/" . $fileName;
         } else {
             $about->avatars = "/images/" . $fileName;
         }
         $about->save();
         return Redirect::to('aboutCms');
     }
 }