function show() { $venues = Venue::all(); $select_timings = Timing::lists('artist_name', 'artist_name'); $title = "Plan by Time"; $user = Auth::user(); $already_selected_timings = []; // if logged in then set this to an actual array if ($user !== null) { $already_selected_timings = $user->timings->lists('artist_name', 'artist_name')->toArray(); } return view('bytime', compact('venues', 'select_timings', 'already_selected_timings', 'title')); }
function show() { $timings = Timing::orderBy('artist_name', 'asc')->get(); $select_timings = Timing::lists('artist_name', 'artist_name'); $title = "Plan by Artist"; $user = Auth::user(); $already_selected_timings = []; // if logged in then set this to an actual array if ($user !== null) { $already_selected_timings = $user->timings->lists('artist_name', 'artist_name')->toArray(); } return view('byartist', compact('timings', 'select_timings', 'already_selected_timings', 'title')); }
public function compareShow($share_str_1, $share_str_2) { $user_1 = User::where(DB::raw('BINARY `share_str`'), '=', $share_str_1)->first(); $user_2 = User::where(DB::raw('BINARY `share_str`'), '=', $share_str_2)->first(); if ($user_1 !== null && $user_2 !== null) { $user_1_timings = $user_1->timings->lists('artist_name')->toArray(); $user_2_timings = $user_2->timings->lists('artist_name')->toArray(); $all_timings = Timing::lists('artist_name')->toArray(); $shared_timings = array_intersect($all_timings, $user_1_timings, $user_2_timings); $timings = $timings = Timing::whereIn('artist_name', $shared_timings)->orderBy('id', 'asc')->get(); $title = "Compare Schedules for " . $user_1->name . " and " . $user_2->name; return view('compareschedule', compact('user_1', 'user_2', 'timings', 'title')); } else { return redirect('/compare'); } }