/** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { $schedule->call(function () { $trip_ids = Trip::where('departure_date', Carbon::today())->lists('id')->toArray(); Booking::where('status', 'reserved')->whereIn('trip_id', $trip_ids)->delete(); })->everyMinute(); }
/** * deletes item and according image, also updates trip and entry that use this picture as featured image * * @param $user_id * @throws \Exception */ public function deleteWithImage($user_id) { if ($entry = TripEntry::where('pic', $this->id)->first()) { $entry->pic = null; $entry->save(); } if ($trip = Trip::where('pic', $this->id)->first()) { $trip->pic = null; $trip->save(); } //deleting image as well File::delete(public_path('img') . '/' . $user_id . '/' . $this->filename); $this->delete(); }
/** * @return \Illuminate\View\View */ public function welcome() { // $collection = array(); // for($i = 1; $i < 10; $i++){ // $ukey = strtoupper(substr(sha1(microtime() . $i), rand(0, 5), 25)); // if(!in_array($ukey, $collection)){ // you can check this in database as well. // $collection[] = implode("-", str_split($ukey, 5)); // } // } // dd($collection); $trips = Trip::where('departure_date', Carbon::tomorrow())->take(3)->get(); // dd($trips->isEmpty()); return view('pages.welcome', ['trips_to_display' => $trips]); }
public function showRanges($id) { return view('trips.index', ['trips' => Trip::where('range_id', $id)->get()]); }
public function deleteTrip($id, $tripID) { $deletedRows = Trip::where('id', $tripID)->delete(); return redirect('adminOverview'); }
public function booking_reports_to_generate(Request $request) { $terminal = TravelCompany::where('slug', $request->travel_terminal)->first(); $trips = Trip::where('travel_company_id', $terminal->id)->get(); return view('admin.reports.booking.report_generate', ['trips' => $trips, 'travel_company' => $terminal->name]); }