Exemple #1
0
 public function getCastDetails()
 {
     if (Request::ajax()) {
         $data = Request::all();
         $cast_id = $data['cast_id'];
         return Cast::find($cast_id);
     }
 }
Exemple #2
0
 public function actionDelete($id)
 {
     $user = Auth::user();
     $cast = Cast::where('user_id', '=', $user->id)->findOrFail($id);
     $cast->delete($cast);
     \Session::flash('flash_message', 'You have successfully deleted a cast.');
     return redirect('cast');
 }
 public function query(Request $request)
 {
     $q = $request->input('q');
     $results["q"] = $q;
     $results["movies"] = Movie::where('name', 'like', '%' . $q . '%')->with('casts')->get();
     $results["casts"] = Cast::where('name', 'like', '%' . $q . '%')->with('movies')->get();
     //        return view('results', ['results' => $results]);
     return $results;
 }
 public function query(Request $request)
 {
     $q = $request->input('q');
     $results["q"] = $q;
     $results["movies"] = [];
     $results["casts"] = [];
     if (!strcmp($q, "")) {
         return $results;
     }
     $results["movies"] = Movie::where('name', 'like', '%' . $q . '%')->take(3)->get();
     $results["casts"] = Cast::where('name', 'like', '%' . $q . '%')->take(3)->get();
     return $results;
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $movies = \App\Movie::all();
     $casts = \App\Cast::all();
     foreach ($movies as $movie) {
         foreach ($casts as $cast) {
             if (random_int(0, 1) == 1) {
                 $cm = new \App\Cast_Movie();
                 $cm->movie_id = $movie->id;
                 $cm->cast_id = $cast->id;
                 $cm->save();
             }
         }
     }
 }
 public function query(Request $request, $id)
 {
     $cast = Cast::find($id);
     $cast->movies()->sync($request->data);
     return;
 }
 /**
  *
  * Modal window, delete role
  * @param array $request
  * @return Response
  *
  */
 public function removeMovieRole()
 {
     if ($this->isAdmin) {
         if (Request::ajax()) {
             $data = Request::all();
             $cast_id = $data['movie'];
             $person_id = $data['person'];
             $person = Persons::findorfail($person_id);
             Cast::find($cast_id)->delete();
             return (string) view('people.roles', compact('person'));
         }
     }
     return "error";
 }
Exemple #8
0
 private function checkCasts($casts)
 {
     $user = Auth::user();
     $currentCasts = array_filter($casts, 'is_numeric');
     $newCasts = array_diff($casts, $currentCasts);
     foreach ($newCasts as $newCast) {
         $cast = Cast::create(['name' => $newCast]);
         $user->casts()->save($cast);
         $currentCasts[] = $cast->id;
     }
     return $currentCasts;
 }
Exemple #9
0
 /**
  *
  * Remove cast member from movie
  * @return Response
  *
  */
 public function removeCastMember()
 {
     if ($this->isAdmin) {
         if (Request::ajax()) {
             $data = Request::all();
             $movie_id = $data['movie'];
             $cast_id = $data['row'];
             $movie = Movies::findorfail($movie_id);
             Cast::find($cast_id)->delete();
             return (string) view('movies.cast', compact('movie'));
         }
     }
     return "error";
 }
Exemple #10
0
 function castAjax($num)
 {
     $cast = Cast::skip($num)->take(16)->get();
     if (count($cast) != 0) {
         return view('castAjax', ['data' => $cast]);
     } else {
         return 'noData';
     }
 }