I'm developing web using Laravel and JWTAuth with default user model at
App\User
Now i'm changin the path of my models to
App\Models
App\Models\User
and i change the jwt config to this
'user' => 'App\Models\User',
but when i try to access my login page, it's show error like this
FatalErrorException in EloquentUserProvider.php line 126:
Class 'App\User' not found
what happening with this? i've changing the setting to App\Models but it's still load to App\ directory?
I re-serve the php artisan, and do composer dump-autoload
It's the same error.
I've resolved my error,
there's one config called auth.php that must updated too
Thanks
Related
I'm using spatie/laravel-permission to handle roles. I installed the package through composer did the migrations, and added the service provider in my config/app.php file, created some roles and everything fine, but when i'm going to use the blade directive #hasanyrole for example:
#hasanyrole('Profesional')
#include('calendar.modal_appointment', ['order_details' => $order_details])
#endhasanyrole
It throws this error:
Call to undefined method App\User::hasAnyRole()
Had to add use Spatie\Permission\Traits\HasRoles; and use HasRoles; on my User model that fixed the problem
I've created a new Laravel 8 app with Jetstream and Livewire. When I make a GET request to any view an ErrorException is launched with message
Trying to get property 'user_id' of non-object
on navigation-dropdown.blade.php which is automatically generated by Jetstream\Livewire. I've looked for this user_id and didn't found on any part of the code.
Check that if user has team in the blade view.
resources/views/navigation-dropdown.blade.php
In line 61:
- #if (Laravel\Jetstream\Jetstream::hasTeamFeatures())
+ #if (Laravel\Jetstream\Jetstream::hasTeamFeatures() && Auth::user()->current_team_id)
In line 162:
- #if (Laravel\Jetstream\Jetstream::hasTeamFeatures())
+ #if (Laravel\Jetstream\Jetstream::hasTeamFeatures() && Auth::user()->current_team_id)
Fortify adds it's own auth routes, but old routes in config/auth.php will still be used (in my case)
Simple solution is to comment out all routes in config/auth.php (if using jetstream with fortify)
and run :
php artisan route:cache
this will make sure that auth routes use fortify actions, so each new account you create will have team created
I got an error Class 'App\Http\Controllers\Debugbar' not found after trying to use in controller action Debugbar::error('Error!');
LARAVEL DEBUGBAR WAS INSTALED IN THIS WAY:
in console composer require barryvdh/laravel-debugbar
in config/app.php adding Barryvdh\Debugbar\ServiceProvider::class and 'Debugbar' => Barryvdh\Debugbar\Facade::class,
Laravel 5.3
Debugbar is working in the website - I can see it at the bottom even after this error. But how to fix this critical error message?
Either explicitly use the Facade or use Debugbar from the root namespace.
\Debugbar::error('hi');
// OR
use \Debugbar;
Debugbar::error('hi');
// OR
use Barryvdh\Debugbar\Facade as Debugbar;
Debugbar::error('hi');
usually when I want to create controller I use php artisan
php artisan make:controller UserController
but in this case I have error in my terminal
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'User' not found
and I wanna use it for users page - update and display users, as well as route
Route::resource('/user', 'UserController');
should I use it like that or something else? and why do I get error?
You get this error because you've used User class somewhere in the code (some controller probably). Find out where did you used it and add this clause to the top of that class:
use App\User;
Or just use full namespace, for example:
\App\User::get();
Any idea's why i get the following error
The [login] attribute is required - what does it mean?
when trying to login with Sentry 2 & Laravel.?
If you need to use anything different from login as attribute in your users table, email for example, first publish the Sentry config:
php artisan config:publish cartalyst/sentry
Then open file app\config\packages\cartalyst\sentry\config.php and edit:
'login_attribute' => 'email',