#7. Admin Auth Login and Logout

Поділитися
Вставка
  • Опубліковано 12 лис 2024

КОМЕНТАРІ • 49

  • @sawastacks
    @sawastacks  7 місяців тому

    For those who need to upgrade Livewire from v2 to v3. Just watch this video:
    ua-cam.com/video/b2tGFfTt2d8/v-deo.htmlsi=6a-KzA3HL_nEKJbs

  • @shaikhmonjurmorshed5596
    @shaikhmonjurmorshed5596 Місяць тому

    when im trying session get fail it is making error session not found . i tried without get
    @if(session('fail'))

    {{ session('fail') }}


    ×


    @endif
    and it fixed the problem. will it make problem in future?

  • @irwanapril8535
    @irwanapril8535 5 місяців тому +1

    I have an error when I click Sign In:
    The POST method is not supported for route admin/login_handler. Supported methods: GET, HEAD.

    • @sawastacks
      @sawastacks  5 місяців тому +2

      Check if you added method="POST" attribute on a form tag.
      And run 'php artisan route:clear' command.

  • @ygaryanto
    @ygaryanto Рік тому +4

    i have error, Class "\Illuminate\Support\Facades\App\Models\Admin" not found

    • @lbicikande
      @lbicikande Рік тому

      is the proble solved ?i have the same case ?

    • @omsaline
      @omsaline 9 місяців тому

      @@lbicikande Did you solve the problem? I'm having the same problem.

    • @khadijaleloo9622
      @khadijaleloo9622 8 місяців тому

      Me too

  • @my-workzq
    @my-workzq 5 місяців тому

    I have bought your script after installing it says Route[admin.login_handler] not defined

  • @my-workzq
    @my-workzq 5 місяців тому +1

    Route[admin.login_handler] not defined

    • @sawastacks
      @sawastacks  5 місяців тому

      Run "php artisan optimize" command

    • @my-workzq
      @my-workzq 5 місяців тому

      @@sawastacks did but not working

  • @nestaho8399
    @nestaho8399 7 місяців тому

    Hello
    In 14:08, when I pressed the "sign in" button, the "remember" word turns red, can you tell me what are the possible reason for this error

  • @my-workzq
    @my-workzq 5 місяців тому +1

    I have installtion issue, the script i have bought is not working i have already mailed you but no response till now,then why did i pay 9.9$??

    • @sawastacks
      @sawastacks  5 місяців тому

      Hi friend.
      Did you check if you follow all steps (7 steps) you find in file named How to
      txt? for setting up downloaded project file?

  • @nazeerkhan1914
    @nazeerkhan1914 Рік тому +1

    Class "\Illuminate\Support\Facades\App\Models\admin" not found brother i found this error i search the internet but not found any satisfied answer. Please can you solve this issue

    • @sawastacks
      @sawastacks  Рік тому +1

      add "use App\Models\Admin;" line on AdminController.php

    • @nazeerkhan1914
      @nazeerkhan1914 Рік тому

      @@sawastacks brother already tried but it's not working

  • @OmarLab
    @OmarLab Рік тому

    i have error The GET method is not supported for route admin/logout_handler. Supported methods: POST.

    • @NitinKumar-vw9gb
      @NitinKumar-vw9gb Рік тому

      check the route list as php artisan route:list and chck the rotues

  • @MuhammadUsman-ok5vs
    @MuhammadUsman-ok5vs Рік тому

    how and where guard is checked whether guard is admin, client or seller.
    if(Auth::guard('admin')->attempt($cred)){
    return redirect()->route('admin.home');
    }
    this code how to know the coming request is admin??

  • @thamidunipun8826
    @thamidunipun8826 8 місяців тому

    Validation Part indicate that error
    "Illuminate\Auth\EloquentUserProvider::validateCredentials(): Argument #1 ($user) must be of type Illuminate\Contracts\Auth\Authenticatable, App\Models\admin given, called in D:\Projects\example-app\vendor\laravel\framework\src\Illuminate\Auth\SessionGuard.php"

    • @sawastacks
      @sawastacks  8 місяців тому

      Make sure you updated Admin.php model like this:

  • @Dr_Riyanto_Official
    @Dr_Riyanto_Official Рік тому

    Class "\App\Models\Admin" not found
    ,
    how to fix it ?

    • @sawastacks
      @sawastacks  Рік тому +1

      Did you remember to import "use App\Models\Admin;" on AdminController?

    • @Dr_Riyanto_Official
      @Dr_Riyanto_Official Рік тому

      @@sawastacks Have done perfectly, thank you very much

    • @omsaline
      @omsaline 9 місяців тому

      ​@@sawastacks I'm getting an error like this
      "Class "\Illuminate\Support\Facades\App\Models\Admin" not found"

  • @vyacheslavvasilev1776
    @vyacheslavvasilev1776 3 місяці тому

    10:54 Oh, it's unclear how to complete this step in Laravel 11. If possible, please tell me how to do it correctly (sorry for my English, i use translator:) )

    • @sawastacks
      @sawastacks  3 місяці тому

      Ohh, Sorry for late. Actually, Livewire 11 structure became with the missing of some files that was available in Laravel 10.
      But those files are still there in Laravel 11.
      So, To use Authenticate.php and RedirectIfAuthenticated.php file use the following Steps:
      1. Open AppServiceProvider.php
      - import these three classes
      use Illuminate\Auth\Middleware\RedirectIfAuthenticated;
      use Illuminate\Auth\Middleware\Authenticate;
      use Illuminate\Support\Facades\Session;
      - Update boot() method like this:
      public function boot(): void
      {
      RedirectIfAuthenticated::redirectUsing(function () {
      return route('admin.dashboard');
      });
      Authenticate::redirectUsing(function () {
      Session::flash('fail','You need to login first');
      return route('admin.login');
      });
      }
      Not: Don't forget to run "php artisan optimize" command after that.
      This is not fully result, but you can make your own strategy using above example especially when you're used multi-guards.

    • @vyacheslavvasilev1776
      @vyacheslavvasilev1776 3 місяці тому

      @@sawastacks Friend, I am very grateful to you for such a detailed answer! And thank you for your video lessons!
      P.S. It seems that creating a project on Laravel 11 was not the best idea 😀 It might have been easier to create a project on Laravel 10 and update it to the current version later.

  • @mubeenmughal1881
    @mubeenmughal1881 9 місяців тому

    Please Fix this error. ( Auth guard [ admin] is not defined )

    • @sawastacks
      @sawastacks  9 місяців тому

      Hi, Just follow step by step, you'll not have this kind of error friend.

    • @mubeenmughal1881
      @mubeenmughal1881 9 місяців тому

      I have checked. But then again this error. 😢

    • @sawastacks
      @sawastacks  9 місяців тому

      @@mubeenmughal1881 Ohh very sorry. If you followed video number 4 correctly: ua-cam.com/video/LUxuc4FuMpM/v-deo.htmlsi=KvKmYZP4O7jxKzRJ
      Run the following commands:
      - composer dump-autoload
      - php artisan config:clear
      If not resolved send the following files my email address "contact@mberecall.com"
      - App/Models/Admin.php
      - App/Models/Seller.php
      - App/Models/User.php
      - App/Config/auth.php

  • @Cofe4RealinIgbo
    @Cofe4RealinIgbo Рік тому

    Thanks for the good job. Pls i got stocked with the following error " Route [admin.login_handler] not defined." i have tried everything including pausing and watching the video for more than 10 times. Pls help me out

    • @sawastacks
      @sawastacks  Рік тому

      Remember to run "php artisan optimize" command in terminal if any route not defined error occured

    • @francknguemete6823
      @francknguemete6823 Рік тому

      Thanks for your answer @@sawastacks.
      I just start your course and i very appreciate it thank you very much for your hard work

  • @OmarLab
    @OmarLab Рік тому +1

    good job thanx a lot man.

  • @zafererkan7070
    @zafererkan7070 Рік тому +2

    we are waiting new videos

  • @imanelaroui8095
    @imanelaroui8095 8 місяців тому

    Validation does not work 🙁

    • @supergirl713
      @supergirl713 8 місяців тому

      yeah same for me it gives me guardc adminn not found do you have same problem

  • @riefkiariyanto6676
    @riefkiariyanto6676 Рік тому

    Soultion Login Always Returns false

  • @marais957
    @marais957 Рік тому

    Auth guard [admin] is not defined.

    • @khadijaleloo9622
      @khadijaleloo9622 8 місяців тому

      Did u find solution for thar

    • @omsaline
      @omsaline 8 місяців тому

      @@khadijaleloo9622 No one has written to find a solution and Irebe Library does not provide an answer regarding a solution.

    • @bentorukmakto2632
      @bentorukmakto2632 6 місяців тому

      @@khadijaleloo9622 Route::prefix('admin')->name('admin.')->group(function () name('admin.' )

  • @marais957
    @marais957 11 місяців тому

    Undefined array key "driver" if (Auth::guard($guard)->check()) {