Exemplo n.º 1
0
 /**
  * Store a newly created Like in storage.
  *
  * @param CreateLikeRequest $request
  *
  * @return Response
  */
 public function store(CreateLikeRequest $request)
 {
     $input = $request->all();
     $like = $this->likeRepository->create($input);
     Flash::success('Like saved successfully.');
     return redirect(route('likes.index'));
 }
Exemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateLikeRequest $request)
 {
     $input = $request->all();
     $like = new Like($input);
     Auth::user()->likes()->save($like);
     return redirect()->back();
 }
Exemplo n.º 3
0
 public function actionCreate(Requests\CreateLikeRequest $request)
 {
     // Create a new model instance and populate it with the request.
     $like = new Like($request->all());
     // Find in the database the photo sent with the request.
     $photo = Photo::findOrFail($request->input('photo_id'));
     // Attach the like to the photo.
     $like = $photo->likes()->save($like);
     // Save the like in the database.
     Auth::user()->likes()->save($like);
     // Redirect.
     return redirect('/photos');
 }