This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* movie group */ | |
$router->group(['prefix' => 'movie', 'as' => 'movie'], function () use ($router) { | |
/* all movies */ | |
$router->get('/all', [ 'as' => 'all', 'uses' => 'MovieController@all']); | |
/* show movies by id */ | |
$router->get('/{id}', [ 'as' => 'show', 'uses' => 'MovieController@show']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use App\Models\User; | |
use Illuminate\Http\Request; | |
use Illuminate\Support\Facades\Hash; | |
use Illuminate\Support\Facades\Validator; | |
class AuthController extends Controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Laravel\Lumen\Testing\DatabaseMigrations; | |
use Illuminate\Support\Facades\Artisan; | |
use app\Libraries\Core; | |
class UserRegistrationTest extends TestCase | |
{ | |
use DatabaseMigrations; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Config; | |
class EndpointTest extends TestCase | |
{ | |
/** | |
* unknown route shoult return 404 | |
* | |
* @return void |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" | |
bootstrap="vendor/autoload.php" | |
colors="true" | |
testdox="true" | |
> | |
<testsuites> | |
<testsuite name="Application Test Suite"> | |
<directory suffix="Test.php">./tests</directory> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* registration */ | |
$router->post('/register', [ 'as' => 'register', 'uses' => 'AuthController@register']); | |
/* login */ | |
$router->post('/login', [ 'as' => 'login', 'uses' => 'AuthController@login']); | |
/* restrict route */ | |
$router->group(['middleware' => 'auth'], function () use ($router) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use App\Libraries\Core; | |
/* v1 group */ | |
$router->group(['prefix' => 'v1', 'as' => 'v1'], function () use ($router) { | |
Core::renderRoutes('v1', $router); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* test response */ | |
$router->get('/ping', [ 'as' => 'ping', function () use ($router) { | |
return 'pong'; | |
}]); | |
/* lumen version */ | |
$router->get('/version', [ 'as' => 'version', function () use ($router) { | |
return $router->app->version(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace app\Http\Controllers; | |
use App\Http\Controllers\Controller; | |
use app\Libraries\Core; | |
use Illuminate\Http\Request; | |
class BaseController extends Controller | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace app\Libraries; | |
use Illuminate\Support\Facades\Log; | |
class Core | |
{ | |
/** | |
* Custom Response HTTP | |
* |