/**
  * @param int $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function destroy($id)
 {
     $horse = $this->horseRepository->findById($id);
     Auth::user()->unFollow($horse);
     Session::put('succes', 'You are no longer following ' . $horse->name);
     return Redirect::back();
 }
Esempio n. 2
0
 /**
  * @param array $data
  * @return \HorseStories\Models\Statuses\Status
  */
 public function create($data = [])
 {
     $status = new Status();
     $status->body = $data['status'];
     $status->horse_id = $data['horse'];
     $status->save();
     if (array_key_exists('picture', $data)) {
         $horse = $this->horses->findById($data['horse']);
         $picture = $this->uploader->uploadPicture($data['picture'], $horse);
         $status->setPicture($picture);
     }
     return $status;
 }