themsaid / laravel-routes-publisher Goto Github PK
View Code? Open in Web Editor NEWA console command to replace deprecated Route::controller() with explicit routes.
License: MIT License
A console command to replace deprecated Route::controller() with explicit routes.
License: MIT License
protected $commands = [
'\Themsaid\RoutesPublisher\RoutesPublisherCommand::class'
];
However, the following does:
protected $commands = [
'Themsaid\RoutesPublisher\RoutesPublisherCommand'
];
Shall I create a PR for the README.md
with this caveat for Laravel 5.2?
[InvalidArgumentException] Attribute [controller] does not exist.
the below warning will shown when i want to convert my controller to routes .
i'm using laravel 5.3 .
should i install this package on my oldest laravel project ?
file_get_contents(D:\projects\codedesign\app\Http/routes.php): failed to open stream: No such file or directory
As the title says, functions in my controller that start with any
do not get put into the generated routes file using Route::any()
Example controller method:
public function getEdit( int $id ) {
# ...
}
Parsing result:
Route::get('access/users/edit', 'Access\UsersController@getEdit');
When it should be:
Route::get('access/users/edit/{id}', 'Access\UsersController@getEdit');
It seems that the command does not work correctly if I have a group with a namespace. For example:
Route::group(['prefix' => 'acme', 'namespace' => 'Acme'], function () {
Route::controller('abc', 'AbcController');
}
This throws the error:
[ReflectionException]
Class App\Http\Controllers\AbcController does not exist
However, it should be looking at App\Http\Controllers\Acme\AbcController
, which does exist. If I change my routes to:
Route::group(['prefix' => 'acme', 'namespace' => 'Acme'], function () {
Route::controller('abc', 'Acme\AbcController');
}
then it works, so I have a workaround, but this means changing all my routes to include the namespace and then presumably fixing them after running the command.
is the ReflectionParameter::hasType only available on php7? maybe you should hint that in describion
E:\OSPanel\domains\laravelCurs.md>php artisan themsaid:publishRoutes
ErrorException : file_get_contents(E:\OSPanel\domains\laravelCurs.md\app\Http/routes.php): failed to open stream: No such file or directory
at E:\OSPanel\domains\laravelCurs.md\vendor\themsaid\laravel-routes-publisher\src\RoutesPublisherCommand.php:53
49| * @return mixed
50| */
51| public function handle()
52| {
53| $exactFileContent = file_get_contents(app_path('Http/routes.php'));
54|
55| $preparedFileContent = $this->prepareFileContent($exactFileContent);
56|
57| $output = '';
Exception trace:
1 file_get_contents("E:\OSPanel\domains\laravelCurs.md\app\Http/routes.php")
E:\OSPanel\domains\laravelCurs.md\vendor\themsaid\laravel-routes-publisher\src\RoutesPublisherCommand.php:53
2 Themsaid\RoutesPublisher\RoutesPublisherCommand::handle()
E:\OSPanel\domains\laravelCurs.md\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29
Please use the argument -v to see more details.
E:\OSPanel\domains\laravelCurs.md>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.