really new to laravel. Im using laravel 5.2. im trying to create a new middleware using "php artisan make:middleware MiddlewareName" but it gives me the following error :
Catchable fatal error: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of
Illuminate\Http\Request, null given, called in
C:\xampp\htdocs\dms\vendor\laravel\framework\src\Illuminate\Routing\RoutingServ
iceProvider.php on line 62 and defined in
C:\xampp\htdocs\dms\vendor\laravel\fra
mework\src\Illuminate\Routing\UrlGenerator.php on line 103
Can anyone please help. Thanks in advance.
This error is usually when you have routes outside the 'web' middleware. Kindly check your routes if you have any that is outside.
Related
I am using Lumen 5.6. When I run any commands or access any functions through Postman I got this error:
Class 'App\Providers\AnnotationConfiguration' not found
When I added this use Ytake\LaravelAspect\AnnotationConfiguration; in AspectServiceProvider.php, the above issue resolved but now I am getting this error.
Type error: Argument 1 passed to Ytake\LaravelAspect\AnnotationConfiguration::__construct() must be of the type array, null given, called in C:\Projects\cs415_api\app\Providers\AspectServiceProvider.php on line 22
I suspect that the following line in AspectServiceProvider returns null.
$app['config']->get('ytake-laravel-aop.annotation')
Any ideas on how to resolve this error?
This issue was resolved here:
https://github.com/ytake/Laravel-Aspect/issues/53
Im trying to implement passport in lumen by using dusterio repo.
But when i do a migrate command (php artisan migrate), i got an error looks like :
[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to undefined method Laravel\Lumen\Application::post()
somebody could help, what's wrong here?
I've followed Laravel 5.3 upgrade guide, which says to add an unauthenticated method in App\Exceptions\Handler.
However, I get the following error when it gets called by the Auth system:
FatalThrowableError in Handler.php line 59:
Type error: Argument 2 passed to App\Exceptions\Handler::unauthenticated() must be an instance of App\Exceptions\AuthenticationException, instance of Illuminate\Auth\AuthenticationException given, called in /Users/Username/Development/ProjectName/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php on line 135
I've been searching for the last half hour and couldn't find a solution.
Any help?
Check how your Handler.php file compares to the 5.3 branch version here: https://github.com/laravel/laravel/blob/5.3/app/Exceptions/Handler.php
Note the unauthenticated() method in Handler.php expects an instance of \Illuminate\Auth\AuthenticationException. Make sure use Illuminate\Auth\AuthenticationException; is included at the top of the file.
In my case, i just deleted whoops... or restore the default Handler.php
I had this Error 500 inexplicable issue while upgrading from Laravel 5.2 to 5.3. No laravel error logs in storage/logs, no Apache error logs. no issue with .env, debug was turned on, no broken .htaccess directives, plus php artisan could not run. Tried everything until I looked in the PHP error logs and found:
PHP Fatal error: Uncaught Error: Undefined constant 'Illuminate\Auth\AuthenticationException' in C:\code\laravel-project\vendor\laravel\framework\src\Illuminate\Container\Container.php:79
So I did what #jon suggested and compared my Handler.php file with the fresh laravel one and found this:
In your App/Exceptions/Handler.php make sure that the classes in the $dontreport array are referenced as either strings in quotes:
'\Illuminate\Auth\AuthenticationException',
'\Illuminate\Auth\Access\AuthorizationException',
'\Symfony\Component\HttpKernel\Exception\HttpException',
'\Illuminate\Database\Eloquent\ModelNotFoundException',
'\Illuminate\Session\TokenMismatchException',
'\Illuminate\Validation\ValidationException',
or this way:
\Illuminate\Auth\AuthenticationException::class,
\Illuminate\Auth\Access\AuthorizationException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
\Illuminate\Session\TokenMismatchException::class,
\Illuminate\Validation\ValidationException::class,
For some reason I found mine to not have the quotes and fixing that got rid of the Error 500.
i tried to do auth as we usually do in laravel5 but it is showing me following error:
ErrorException in AuthManager.php line 152: Undefined index: provider
after that i tried following link
Authentication: index not found: provider
then got following error:
call_user_func_array() expects parameter 1 to be a valid callback,
class 'Illuminate\Auth\TokenGuard' does not have a method 'attempt'
now i am stuck for this
So,what should i do for user signin authentication?
If you're using the Auth middleware on your route make sure to uncomment the appropriate line in your bootstrap/app.php file...
$app->routeMiddleware([
'auth' => App\Http\Middleware\Authenticate::class,
]);
I'm learing laravel 5. A day, when I run php artisan command I got this error
Catchable fatal error: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in C:\xampp\htdocs\premiumlens\vendor\laravel\framework\src\Illuminate\Routing\RoutingServiceProvider.php on line 62 and defined in C:\xampp\htdocs\premiumlens\vendor\laravel\framework\src\Illuminate\Routing\UrlGenerator.php on line 102
Almost application functions work perfect. But may not all. I'm sure the error is not caused by UrlGenerator.php
Now I cant use any artisan functions. How can I detect which file cause this issue.
Thank you !
I think you used url() helper in your config file, find where you put url() helper in your config file and remove it. your problem will be solved. i had this same problem and solved by removing url() form config file..
url('bassets/plugins/highcharts/highcharts.css'),