3
0
Fork 0
This repository has been archived on 2024-11-14. You can view files and clone it, but cannot push or open issues or pull requests.
ThemeParkPlus-Panel/app/Http/Controllers/ControlController.php
2021-06-27 21:01:43 +02:00

45 lines
1 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Color\MinecraftColor;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redirect;
class ControlController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware(['auth', 'verified', '2fa']);
}
/**
* Show the application dashboard.
*
* @param $attraction_id
* @param $pin
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index($attraction_id, $pin)
{
if(!preg_match('/^([0-9]){9}$/', $pin))
return Redirect::route('status');
$data = DB::table('attraction')->select('name')->where('id', '=', $attraction_id)->first();
if(empty($data))
return Redirect::route('status');
return view('control')->with([
'attraction_id' => $attraction_id,
'attraction_name' => MinecraftColor::stripColor( $data->name),
'pin' => $pin
]);
}
}