Example #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Motion $motion)
 {
     if (Auth::check()) {
         Vote::where('motion_id', $motion->id)->where('user_id', Auth::user()->id)->update(['visited' => true]);
     }
     if (!Auth::user()->can('create-motions') && ($motion->status === 'draft' || $motion->status === 'review')) {
         abort(403, 'Forbidden access point.');
     }
     // runs this through the transformer
     return $this->motionTransformer->transform($motion->toArray());
 }