46 lines
1 KiB
PHP
46 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
|
||
|
]);
|
||
|
}
|
||
|
|
||
|
}
|