You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

55 lines
1.7 KiB

<?php namespace App\Filters;
/******************************************************************************************************************
* RPSLS - Rock, Paper, Scissors, Lizard, Spock Game
*
* @file app/Filters/GameFilters.php
* @package App\Filters
* @description
* Runs before start of Program, Calls DB Build if needed.
* @author Rick Hays
* @date 11/15/2019
* @license MIT
* @copyright Copyright © 2019 - Rick Hays, All Rights Reserved.
*
* Revisions:
* YYYY-MM-DD XX Description
******************************************************************************************************************/
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Filters\FilterInterface;
class GameFilters implements FilterInterface
{
/***************************************************************************************************************
* @method before
* @description
* Calls setup page if GAME.DB does not exist.
*
* @param RequestInterface $request
*
* @return \CodeIgniter\HTTP\RedirectResponse|mixed
*/
public function before(RequestInterface $request)
{
// Database Initalization
if (!file_exists('../app/Database/game.db'))
{
return redirect()->to(site_url('setup'));
}
}
/***************************************************************************************************************
* @method after
* @description
* Currently not used.
*
* @param RequestInterface $request
* @param ResponseInterface $response
*
* @return mixed|void
*/
public function after(RequestInterface $request, ResponseInterface $response)
{
// Do something here
}
}