I create a plugin : php artisan create:plugin acme.note
and then I create a controller : php artisan create:controller acme.note noteManage
and then I creating a file named routes.php in a same directory as the plugin registration file.
Here is my routes.php
Route::get('post/create','noteManage@create');
Route::post('post','noteManage@store');
but it does not working
I run php artisan route:list but it shows an error : class noteManage does not exist
did I miss something?
Take a look at the example plugin here https://github.com/daftspunk/oc-laravelapi-plugin
Make sure you prefix your PHP class with its namespace.
@gabsource hi I tried and it works! thank you !
but I still have a problem
I use a href="noteManage/create" and my routes.php is Route::get('noteManage/create', 'noteManage@welcome');
but it shows page not found 404
is that I link the wrong way?
Try using href="{{ 'noteManage/create' | app }}" in your view.
@tobias-kuendig
hi I tried but it does not work :'(
Routes defined in the routes.php are relative to the website root. So with the route you mentioned you should have to open something like http://localhost/noteManage/create.
Writing this route file :
<?php
Route::get('my/route/path/is/long', 'Acme\Foo\Classes\MyLongRoute@demo');
will call in plugins/acme/foo/classes/MyLonRoute.php the method public function demo() { ... } when you open the page http://localhost/my/route/path/is/long if your plugin is installed and activated.
It should be more appropriate to use the Forum, IRC or Slack to get help. Github issues should be reserved for bugs & building feature like mentioned in https://github.com/octobercms/october/blob/develop/CONTRIBUTING.md
Pushing a demo plugin somewhere on a public VCS, that reproduce your problem, will make it easier for people to help you.
@gabsource
Thank you so much!!
It works!!
Thank you!
Great ! Please, close this issue if your problem is resolved.
Most helpful comment
Take a look at the example plugin here https://github.com/daftspunk/oc-laravelapi-plugin
Make sure you prefix your PHP class with its namespace.