Пример #1
0
 /**
  * Save the number of times a video is viewed.
  *
  * @param  \Illuminate\Http\Request
  * @return \Illuminate\Http\Response
  */
 public function viewCount(Request $request)
 {
     if (isset($request->id)) {
         $video = Videos::find($request->id);
         $video->play = is_null($video->play) ? 1 : $video->play + 1;
         $video->save();
         return new Response($video->play, 200);
     }
 }
Пример #2
0
 /**
  * Test videos are paginated.
  *
  * @return void
  */
 public function testVideosPaginated()
 {
     factory(Soma\Videos::class, 24)->create();
     $results = Videos::paginate(6);
     $this->assertEquals(6, $results->perPage());
 }