コード例 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $news2 = new Testimonial(array($name = Input::get('name'), $testimonial = Input::get('testimonial'), $image = Input::file('image')));
     if ($image == '') {
         return \Redirect::route('testimonial')->with('message', 'You must fill required form');
     } else {
         $imageName = time() . '.' . $image->getClientOriginalExtension();
         $path = public_path('/img/' . $imageName);
         Image::make($image->getRealPath())->save($path);
         $news2->image = 'img/' . $imageName;
         $news2->cust_name = $name;
         $news2->testimonial = $testimonial;
         $news2->save();
         return \Redirect::route('testimonial', array($news2->id));
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(TestimonialRequestForm $request)
 {
     $testimonial = new Testimonial(array('training_id' => $request->get('training_id'), 'author_name' => $request->get('author_name'), 'testimonial' => $request->get('testimonial')));
     $testimonial->save();
     return redirect('/create_testimonial')->with('status', 'Your Testimonial is created successfully.');
 }