mirror of
https://github.com/ZorgCC/lumen-generators.git
synced 2024-12-26 05:55:28 +03:00
add support for lumen 5.3.x
This commit is contained in:
parent
93856362b7
commit
55fcf27362
@ -58,4 +58,37 @@ $I->writeToFile('./app/Http/routes.php', '<?php
|
||||
$app->get("/", function () use ($app) {
|
||||
return $app->welcome();
|
||||
});
|
||||
');
|
||||
');
|
||||
|
||||
|
||||
$I->wantTo('run wn:routes in Lumen 5.3+');
|
||||
mkdir('./routes');
|
||||
$I->writeToFile('./routes/web.php', '<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register all of the routes for an application.
|
||||
| It is a breeze. Simply tell Lumen the URIs it should respond to
|
||||
| and give it the Closure to call when that URI is requested.
|
||||
|
|
||||
*/
|
||||
|
||||
$app->get("/", function () use ($app) {
|
||||
return $app->version();
|
||||
});
|
||||
');
|
||||
|
||||
$I->runShellCommand('php artisan wn:route foo --controller=customController');
|
||||
$I->seeInShellOutput('foo routes generated');
|
||||
$I->openFile('./routes/web.php');
|
||||
$I->seeInThisFile("
|
||||
\$app->get('foo', 'customController@all');
|
||||
\$app->get('foo/{id}', 'customController@get');
|
||||
\$app->post('foo', 'customController@add');
|
||||
\$app->put('foo/{id}', 'customController@put');
|
||||
\$app->delete('foo/{id}', 'customController@remove');
|
||||
");
|
||||
$I->deleteDir('./routes');
|
||||
|
@ -13,7 +13,11 @@ class RouteCommand extends BaseCommand {
|
||||
{
|
||||
$resource = $this->argument('resource');
|
||||
|
||||
$content = $this->fs->get('./app/Http/routes.php');
|
||||
$routesPath = './routes/web.php';
|
||||
if (! $this->fs->exists($routesPath))
|
||||
$routesPath = './app/Http/routes.php';
|
||||
|
||||
$content = $this->fs->get($routesPath);
|
||||
|
||||
$content .= PHP_EOL . $this->getTemplate('routes')
|
||||
->with([
|
||||
@ -22,7 +26,7 @@ class RouteCommand extends BaseCommand {
|
||||
])
|
||||
->get();
|
||||
|
||||
$this->save($content, './app/Http/routes.php', "{$resource} routes", true);
|
||||
$this->save($content, $routesPath, "{$resource} routes", true);
|
||||
}
|
||||
|
||||
protected function getController()
|
||||
@ -34,4 +38,4 @@ class RouteCommand extends BaseCommand {
|
||||
return $controller;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user