-1

hi iam using these admin package. this package provide CRUD opertion and roles and logins,now i want to customize the login controller. i search in all folers,there is no login controller. can anyone find out to customize login controller in these package.

this is version iam using

"require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "dwij/laraadmin": "1.0.40"
    }

in my folder structure there is no controller enter image description here

vicky
  • 415
  • 2
  • 10

1 Answers1

1

in the App\Http\Controllers\Auth\LoginController you should see:

...
class LoginController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles authenticating users for the application and
    | redirecting them to your home screen. The controller uses a trait
    | to conveniently provide its functionality to your applications.
    |
    */

    use AuthenticatesUsers;
    ...

the login(Request $request) method that handle the authentication is included in AuthenticatesUsers so if you want to use your own method just define a new login() method in the LoginController like this:

class LoginController extends Controller
{
    use AuthenticatesUsers;

    ...

    public function login(Request $request) {
        //your logic
    }

    ...
HichemTech
  • 389
  • 2
  • 6
  • thanks man.so, i can write my own controller right? – vicky Aug 15 '23 at 12:31
  • here, i need to verfiy the user and set token in session cookies, and also save roles in application storage – vicky Aug 15 '23 at 12:32
  • 3
    the controller should be : App\Http\Controllers\Auth\LoginController, just create a login function and you can customize the login logic there. you can see the original login login in (Illuminate/Foundation/Auth/AuthenticatesUsers)[https://github.com/laravel/framework/blob/6.x/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php#L31) Orif you are using Laravel 5.0 you can find it here (Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers)[https://github.com/laravel/framework/blob/5.0/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php#L71) – HichemTech Aug 15 '23 at 12:45
  • i attached screen shot of my folder structure. my authController are using these ```namespace App\Http\Controllers\Auth; use App\User; use App\Models\Employee; use App\Role; use Validator; use Eloquent; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\ThrottlesLogins; use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers; – vicky Aug 15 '23 at 12:54
  • 1
    yes you're using Laravel 5, so inside the AuthController you can overwrite the login method by defining `postLogin()`, the base of this method is defined in [Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers](https://github.com/laravel/framework/blob/5.0/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php#L71) – HichemTech Aug 15 '23 at 13:36
  • hi Hichem, iused that postLogin() into AuthController,but its wont working – vicky Aug 17 '23 at 06:07
  • please can i see the routes/web.php of yours ? – HichemTech Aug 17 '23 at 14:08