Beispiel #1
0
 /**
  *
  * Show form to edit existing movie
  * @param integer $movie_id
  * @return Response
  *
  */
 public function edit($movie_id)
 {
     if (!$this->isAdmin) {
         return view('auth.login');
     }
     Session::put('movie_id', $movie_id);
     $movie = Movies::findorfail($movie_id);
     $movie->genres;
     $movie->purchased = date("d-m-Y", strtotime($movie->purchased));
     $movie->cover = $this->checkImageExists($movie->image, $movie->sort_name, 'covers');
     $movie->cover_count = strlen($movie->cover);
     $values = json_decode($movie);
     $movie->genres = DB::table('categories')->where('movie_id', $movie_id)->lists('genre_id');
     $movie->tags = DB::table('tags')->where('movie_id', $movie_id)->lists('keyword_id');
     $fields = Forms::getFormFields('create_movie', true);
     $app = app();
     $options = $app->make('stdClass');
     $options->movies = Movies::orderBy('sort_name')->lists('name', 'movie_id')->toArray();
     $options->certificates = Certificates::lists('title', 'certificate_id')->toArray();
     $options->studios = Studios::orderBy('name', 'asc')->lists('name', 'studio_id')->toArray();
     $options->formats = Formats::lists('type', 'format_id')->toArray();
     $options->actors = Persons::select(DB::raw("CONCAT(forename, ' ', surname) AS full_name"), 'person_id')->whereNotIn('person_id', function ($query) use($movie_id) {
         $query->select('person_id')->from('cast')->where('movie_id', $movie_id);
     })->orderBy('forename')->lists('full_name', 'person_id')->all();
     $options->crew = Persons::select(DB::raw("CONCAT(forename, ' ', surname) AS full_name"), 'person_id')->orderBy('forename')->lists('full_name', 'person_id')->all();
     $options->keywords = Keywords::orderBy('word')->get();
     foreach ($options->keywords as $keyword) {
         $keyword->selected = in_array($keyword->keyword_id, $movie->tags) ? true : false;
     }
     $options->genres = Genres::all();
     foreach ($options->genres as $genre) {
         $genre->selected = in_array($genre->genre_id, $movie->genres) ? true : false;
     }
     $user = $this->isAdmin;
     return view('movies.edit', compact('movie', 'fields', 'values', 'options', 'user'));
 }
Beispiel #2
0
 public function getAvailableCrew()
 {
     if (Request::ajax()) {
         $data = Request::all();
         $movie_id = $data['movie'];
         $actors = Persons::select(DB::raw("CONCAT(forename, ' ', surname) AS full_name"), 'person_id')->whereNotIn('person_id', function ($query) use($movie_id) {
             $query->select('person_id')->from('crew')->where('movie_id', $movie_id);
         })->orderBy('forename')->get()->toJson();
         return $actors;
     }
 }
Beispiel #3
0
 /**
  *
  * Show all persons whose birthday is today
  * @return Response
  *
  */
 public static function getTodaysBirthdays()
 {
     return Persons::select('persons.person_id', 'birthday', 'deceased', DB::raw('CONCAT(forename, " ", surname) as name'), 'image')->where(DB::raw('DATE_FORMAT(birthday,"%m-%d")'), DB::raw('DATE_FORMAT(NOW(),"%m-%d")'))->orderBy('forename', 'asc')->orderBy('surname', 'asc')->get();
 }