Questions tagged [laravel-authentication]

Laravel ships with several pre-built authentication controllers for user registration, authentication, and password reset.

Laravel ships with several pre-built authentication controllers for user registration, authentication, and password reset.

376 questions
0
votes
1 answer

How to Add a Custom Function That Can Be Chained with the Auth() Function?

As stated in the documentation, the auth() function can be used instead of the Auth facade, returns an authenticator instance and can be used like this: auth()->check() auth()->guest() auth()->id() auth()->user() As you can see - I can chain…
PeraMika
  • 3,539
  • 9
  • 38
  • 63
0
votes
1 answer

Laravel base URL redirecting to /home for no reason

I'm learning laravel and I have a problem with my base url which is http://localhost/. It keeps redirecting to http://localhost/home which is the base authentication route and since im not logged in, it redirects me to http://localhost/login. I want…
Dastan
  • 176
  • 3
  • 15
0
votes
1 answer

Auth::check() Returns False in Laravel Model but Returns True in Controller

I have a Laravel application where I want to get Auth::user in my model. However, when I do Auth::check() in the model, it returns false whereas in the controller it returns true. protected static function boot() { parent::boot(); if…
tayyab_fareed
  • 559
  • 9
  • 15
0
votes
3 answers

Laravel 5.5 : Last Login and Last Login IP are not to be updating on successful login

I am using laravel 5.5, want to record Last Login (date time)and Last Login IP on each successful login.but its not updating. LoginController:
Entrepreuner
  • 53
  • 4
  • 11
0
votes
1 answer

Laravel Roles and Permissions Packages

I want to create roles and permissions like the following: Each post has many users. Type A user can do everything (create, edit, update and delete) the post. Type B user can only create, edit and update the post. Type C user can only edit and…
0
votes
1 answer

How to create a simple auth guard in Laravel 5.7?

I am trying to implement a very simple authentication mechanism with Laravel 5.7, and am not sure of the best approach to take. For the sake of reducing my issue to the most simple terms possible, let's say that I want to protect certain routes so…
0
votes
0 answers

Laravel can't access user in middleware on subdomain

I try to access the current user in my custom middleware from the web group. To use the session on multiply domains I set the domain value in the session config 'domain' => env('SESSION_DOMAIN', '.localhost'),. Then I login to my application. When I…
Markus
  • 1,909
  • 4
  • 26
  • 54
0
votes
2 answers

How to get Logged in user detail before redirecting to page after authentication in laravel

I am developing an web backend for swiggy type of application. In that back-end i want to display all restaurants added by that particular partner user in header and that drop-down will display on all pages, so i want to do that get all restaurants…
Adarsh Bhatt
  • 548
  • 1
  • 9
  • 30
0
votes
1 answer

How to mock authentication user on unit tests with Codeception in Laravel 5?

I have to convert my unit tests to codeception. I need to use loginWithFakeUser() function from this article - How to mock authentication user on unit test in Laravel? public function loginWithFakeUser() { $user = new User([ 'id' => 1, …
mmuncada
  • 528
  • 1
  • 11
  • 31
0
votes
1 answer

Laravel After Logging in is going to / Route

This is mine LoginController protected $redirectTo; /** * Create a new controller instance. * * @return void */ public function __construct() { if(Auth::check() && Auth::user()->role->id == 1){ …
Asad
  • 617
  • 2
  • 8
  • 23
0
votes
2 answers

How to use more than one table to auth in Laravel 5.6 ?

This is my tables structure i want to make auth in laravel 5.6 : permission: permission_id , permission login: login_id , permission_id , Full_name , password email: email_id , login_id , email phone: phone_id , login_id , phone_number users can…
0
votes
1 answer

Laravel 5 - Move Auth module in to a specific module

I am creating a modular application using nwidart package in Laravel 5.6. The command php artisan make:auth will create the necessary controllers and blades for authentication but I want to create a User module and move these things inside this…
M a m a D
  • 1,938
  • 2
  • 30
  • 61
0
votes
1 answer

Laravel login with more custom fields

I want a user to login using his/her id_number(school id number) only. Or if he forgets his id number, I want him to login using his Name, course and year graduated. Is it possible to implement this using Laravel auth? I am really new to laravel. I…
bryce04
  • 53
  • 7
0
votes
1 answer

Laravel Authentication Reset

I'm having difficulty how do I get the user id based on the token generated by laravel? I'm not very familiar with framewrok can anyone help me? class ForgotPasswordController extends Controller { use SendsPasswordResetEmails; /** *…
0
votes
1 answer

How to pass the subscription to other users using Laravel Cashier

I’m building a project using Laravel PHP Framework. I’m using Laravel Auth for authentication and Laravel Cashier as an interface for Stripe. How can I accomplish the following scenario: A user subscribed to my service. He is allowed to add users…