Added Shows, ActionFoto's and Attraction Status
This commit is contained in:
parent
b105bd7db7
commit
ad320963fc
30 changed files with 1190 additions and 503 deletions
54
app/Http/Controllers/RidecountController.php
Normal file
54
app/Http/Controllers/RidecountController.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RidecountController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware(['auth', 'verified', '2fa']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @param $attraction_id
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function index($attraction_id)
|
||||
{
|
||||
$name = DB::table('attraction')->select('name')->where('id', '=', $attraction_id)->first()->name;
|
||||
$top10 = DB::table(DB::raw('ridecount, (SELECT @row_number:=0) AS t'))->select('uuid', DB::raw('SUM(`count`) AS `count`'), DB::raw('(@row_number:=@row_number + 1) AS `num`'))
|
||||
->where('attractionId', '=', $attraction_id)
|
||||
->whereRaw('YEARWEEK(date, 1) = YEARWEEK(CURDATE(), 1)')
|
||||
->groupBy('uuid')
|
||||
->orderByDesc('count')
|
||||
->take(10)->get()->all();
|
||||
|
||||
$personal = DB::table('ridecount')
|
||||
->where('attractionId', '=', $attraction_id)
|
||||
->where('uuid', '=', Auth::user()->uuid)
|
||||
->sum('count');
|
||||
|
||||
$total = DB::table('ridecount')
|
||||
->where('attractionId', '=', $attraction_id)
|
||||
->sum('count');
|
||||
|
||||
return view('ridecount')->with([
|
||||
'name' => $name,
|
||||
'top10' => $top10,
|
||||
'personal' => $personal,
|
||||
'total' => $total
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue