v0.14.15 - Removed the first foreach in location show, and made an inner join instead, so it comes in correct order (by time), instead of by time and by machine id.
Added: The Reservations now gets deleted when time is past their washing time, as soon as you go onto your own reservations, the admin page for reservations or when the location show page reloads (every 1 minut)
This commit is contained in:
@@ -15,6 +15,8 @@ use App\WashingReservation;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\View\View;
|
||||
|
||||
date_default_timezone_set('Europe/Copenhagen');
|
||||
|
||||
class WashingReservationController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
@@ -37,6 +39,8 @@ class WashingReservationController extends Controller
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
WashingReservation::query()->where('time', '<', date('Y-m-d H:i:s', strtotime('-1 hour')))->delete();
|
||||
|
||||
$reservations = WashingReservation::query()->orderBY('time' , 'asc')->paginate($request->query("limit", 20));
|
||||
|
||||
return Response::detect("washing-reservations.index", [ "reservations" => $reservations]);
|
||||
@@ -260,6 +264,8 @@ class WashingReservationController extends Controller
|
||||
|
||||
public function appindex(Request $request)
|
||||
{
|
||||
WashingReservation::query()->where('time', '<', date('Y-m-d H:i:s', strtotime('-1 hour')))->delete();
|
||||
|
||||
$reservations = WashingReservation::query()->where("user_id", "=", auth()->user()->id)->orderBY('time' , 'asc')->paginate($request->query("limit", 20));
|
||||
|
||||
return Response::detect("washing-reservations.index", [ "reservations" => $reservations]);
|
||||
|
||||
Reference in New Issue
Block a user