Пример #1
0
 /**
  * Delete series.
  *
  * /admin/series/{id} delete
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function destory(Request $request, $id)
 {
     $truePassword = Auth::user()->password;
     if (Hash::check($request->get('password'), $truePassword)) {
         // delete image.
         ImageManager::delete($this->series->findImageById($id));
         // remove from db.
         $this->series->deleteById($id);
         Log::info(lang("log.deleteSeriesSuccess", "You delete a series."));
         return $this->responseJson(['message' => '删除成功!']);
     }
     Log::warning(lang("log.deleteSeriesError", "MayBe Someone want delete your series."));
     return $this->responseJson(['error' => '密码错误,记录日志'], 403);
 }
Пример #2
0
 /**
  * Get all videos.
  *
  * /admin/videos get
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function index()
 {
     $videos = $this->videos->findAll();
     $series = $this->series->listIdAndTitle();
     return $this->responseJson(compact('videos', 'series'));
 }
Пример #3
0
 /**
  * Home page.
  *
  * / get
  *
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $series = $this->series->findAllWithRelationHavePublishedVideoLimit();
     return view('pages.index', compact('series'));
 }
Пример #4
0
 /**
  * Show series.video.show
  *
  * /series/id/videos/{id} get
  *
  * @param  integer $id
  * @param  integer $uid
  *
  * @return \Illuminate\View\View
  */
 public function showVideo($slug, $vid)
 {
     $video = $this->videos->findById($vid);
     $series = $this->series->findAllWithRelationBySlug($slug);
     return view('series.video', compact('video', 'series'));
 }