When I am trying to run php artisan route:cache in lumen project, I am getting following error,
[invalid argument exception]
There is not commend defined in the 'route' namespace.
My route file is,
$app->get('/', 'App\Http\Controllers\WebController#index');
Any idea?
This command exists only in Laravel and in Lumen it does not. it is not needed as Lumen is anyway optimized for best performance.
Type php artisan to see all possible commands in Lumen.
Related
Getting this error when calling any api:
Argument 3 passed to Lcobucci\\JWT\\Signer\\Hmac::doVerify() must be an instance of Lcobucci\\JWT\\Signer\\Key, null given, called in /app/vendor/lcobucci/jwt/src/Signer/BaseSigner.php on line 44
I am using tymondesigns/jwt-auth with laravel for api authentication.
I tried running this php artisan optimize after generating jwt:secret
My laravel application is hosted on basic heroku server with pgsql
It's possible that you are getting this error when you uploaded the applications before implementing the JWT and re-uploaded directly without reuploading the .env file.
If this is the case, the simplest way to solve this adding the JWT key in your .env file :
Here an example:
JWT_SECRET=jghgvfuldMpw5i4039393939393372y98bEWumqd9ls7Uk8DEpr0gIhgftrf
Or create jwt key with the command :
php artisan jwt:secret
Don't forget to clear config after changing your environment :
php artisan config:clear
php artisan config:cache
I have a running app written on Laravel 5.7. I tried to change the record in composer.json to match "5.8.*" and ran composer update. On my local (win10/WAMP) machine it went fine, but on the staging server (Debian 9/nginx) the update command changed the vendor contents and failed at the end.
Since then anything I do with the app on the server I get this error and I can't find any information anywhere.
Call to undefined method Illuminate\Routing\RouteFileRegistrar::get()
And this is the line that fails:
$this->get('login', 'Auth\LoginController#showLoginForm')->name('login');
Thanks in advance!
remove "$this" from your routes and use "Route::"
It is a problem with the routes. Mainly, you get this problem when you are using routes with resource or resources. Make sure you do not have any problem in routes by using the command:
#php artisan route:list
If you are getting any problem while route listing please fix it.
I solved this problem in Laravel 5.8 by fixing routes.
Hope this will help.
I am upgrading application written in Laravel 4.2 to Laravel 5.2.
I have long namespaces for my controllers and want to shorten them.
For example:
CustomServiceProvider.php
public function register()
{
$this->app->bind('Shortname\Somecontroller', 'Really\Really\Long\Name\Somecontroller');
}
routes.php
$router->get('someroute', ['uses' => 'Shortname\Somecontroller#someFunction']);
was possible inside custom service provider and works in Laravel 4.2 and Larave 5.1. After I've started migrating to Laravel 5.2 it stopped working.
Closest I came to the solution was this issue report: https://github.com/laravel/framework/issues/14920 but it doesn't work either.
This works for example:
routes_alternative.php
$router->get('someroute', ['uses' => 'Really\Really\Long\Name\Somecontroller#someFunction']);
I've tried Really\Really\Long\Name\Somecontroller::class and moving everything to RouteServiceProvider. I've also tried artisan route:clear,artisan cache:clear, artisan dump-autoload, artisan clear-compiled and all sorts of other composer and artisan shenanigans.
All actions result in exception:
ReflectionException in Route.php line 280:
Class Shortname\Somecontroller does not exist
Does someone have similar expiriences and was able to solve it?
I am using laravel-5.3. After renaming the app when I'm trying to start the server I'm getting the following error
[Symfony\Component\Debug\Exception\FatalThrowableError] Class
'App\Providers\AppServiceProvider' not found
What should i do? I am new at Laravel.
This is probably because you have your configuration cached. You can solve it with the artisan command 'config:cache':
php artisan config:cache
Before this, make sure that you have the correct namespaces in your application.
Suddenly when i type php artisan or any artisan command
i seen this message
[ErrorException]
Trying to get property of non-object
I tried the following
1- php artisan clear-compiled
2- To delete vendor directory and use composer install Or composer update
3- clone a standard Laravel app and put my files app dir and my config
and use composer commands but with step the error has changed to be
[ErrorException]
Trying to get property of non-object
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
Any Suggestions ?
Thanks
If I understand well, you have this issue when you use your app files. It probably means that you have some problem in constructor - you try to run function and the object is not initialized. You should not set up things in constructors (look for example at your controllers) or you will get some "strange" errors and your artisan won't work
After navigation on my app i found the issue in my ServiceProviderClass boot() method in particular when comment one method get data according to subDomain name artisan worked well
Laravel Doc hint for this method
This method is called after all other service providers have been registered, meaning you have access to all other services that have been registered by the framework
for more read Laravel service provider