v1.5.23a - Fix of multiple events
This commit is contained in:
parent
d1b083bae1
commit
be09caaf34
skolehjem
app/Http/Controllers
database/migrations
2021_01_22_002613_remove_event.php2021_01_22_002613_remove_news.php2021_01_22_002613_remove_reservation.php
resources/views/app/events
|
@ -36,7 +36,7 @@ class MultipleEventsController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
$multiEvents = MultipleEventsParent::join("multiple_events", "multiple_events.multiple_events_parent_id", '=', 'multiple_events_parent.id')->groupBy('multiple_events_parent_id')->orderBy('multiple_events.date', 'desc')->selectRaw('multiple_events_parent.*, max(date) as date')->get();
|
||||
$multiEvents = MultipleEventsParent::join("multiple_events", "multiple_events.multiple_events_parent_id", '=', 'multiple_events_parent.id')->groupBy('multiple_events.multiple_events_parent_id', 'multiple_events_parent.id', 'multiple_events_parent.week', 'multiple_events_parent.resource_id', 'multiple_events_parent.created_at', 'multiple_events_parent.updated_at')->selectRaw('multiple_events_parent.*, max(date) as date')->get();
|
||||
|
||||
return Response::detect("multiple-events.index", [ "multiEvents" => $multiEvents]);
|
||||
}
|
||||
|
@ -124,6 +124,23 @@ class MultipleEventsController extends Controller
|
|||
return Response::detect("multiple-events.show", [ "week" => $multiEventParent->week, "multiEvents" => $multiEvents]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display signups for event.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function accountsignups(Request $request)
|
||||
{
|
||||
// Find every event you have clicked on. And find all users to that event, and the event name itself.
|
||||
$events = UserEvent::join('users', 'users.id', '=', 'user_events.user_id')->where('multiple_event_id', $request->multiEvent)->select('user_events.*', 'users.name_first', 'users.name_last', 'users.phone')->get();
|
||||
|
||||
if (count($events) == 0)
|
||||
$events = Event::where('id', $request->event)->get();
|
||||
|
||||
return Response::detect("multiple-events.signups", [ "multiEvent" => $events ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.-
|
||||
*
|
||||
|
@ -197,18 +214,6 @@ class MultipleEventsController extends Controller
|
|||
return Response::detect("events.index", [ "events" => $events]);
|
||||
}
|
||||
|
||||
|
||||
public function accountsignups(Request $request)
|
||||
{
|
||||
// Find every event you have clicked on. And find all users to that event, and the event name itself.
|
||||
$multiEvents = UserEvent::join('users', 'users.id', '=', 'user_events.user_id')->join('multiple_events', 'multiple_events.id', '=', 'user_events.multiple_event_id')->where('multiple_event_id', $request->multiEvent)->get();
|
||||
|
||||
if (count($multiEvents) == 0)
|
||||
$multiEvents = Event::where('id', $request->event)->get();
|
||||
|
||||
return Response::detect("multiple-events.signups", [ "multiEvent" => $multiEvents ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RemoveEvent extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/*
|
||||
public function up()
|
||||
{
|
||||
\Illuminate\Support\Facades\DB::unprepared("CREATE OR REPLACE EVENT `remove_event` ON SCHEDULE EVERY 1 HOUR STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO
|
||||
DELETE FROM events WHERE HOUR(TIMEDIFF(NOW(), events.date)) >= 24 AND date(events.date) < CURDATE()");
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RemoveNews extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/*
|
||||
public function up()
|
||||
{
|
||||
\Illuminate\Support\Facades\DB::unprepared("CREATE OR REPLACE EVENT `remove_news` ON SCHEDULE EVERY 1 HOUR STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO
|
||||
DELETE FROM news WHERE news_expiration_date < NOW();");
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RemoveReservation extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/*
|
||||
public function up()
|
||||
{
|
||||
\Illuminate\Support\Facades\DB::unprepared("CREATE OR REPLACE EVENT `remove_reservation` ON SCHEDULE EVERY 1 HOUR STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO
|
||||
DELETE FROM washing_reservations WHERE time <= DATE_SUB(NOW(), INTERVAL 1 HOUR)");
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -63,7 +63,7 @@
|
|||
<a class="sde-blue text-center m-none p-none bold" href="javascript:void(0);" @if($key == "events") onclick="ajaxCall({{ $userevent->id }}, this)" @elseif($key == "multiple") onclick="ajaxMultiCall({{ $userevent->id }}, this)" @endif id="f">{{__('msg.tilmeld')}}</a>
|
||||
@endif
|
||||
<a class="sde-blue text-center m-none p-none bold" href="{{route("events.show", ["event" => $userevent->id ])}}">{{__('msg.læsmere')}}</a>
|
||||
<a class="sde-blue text-center m-none p-none bold" href="{{route("events.accountsignups", ["event" => $userevent->id ])}}">{{__('msg.sedeltagere')}}</a>
|
||||
<a class="sde-blue text-center m-none p-none bold" @if($key == "events") href="{{route("events.accountsignups", ["event" => $userevent->id ])}}" @elseif($key == "multiple") href="{{route("multiple-events.accountsignups", ["multiEvent" => $userevent->id])}}" @endif>{{__('msg.sedeltagere')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue