Master Laravel 11: Create RESTful APIs for User Management with Sanctum | Token Based API

Поділитися
Вставка
  • Опубліковано 8 січ 2025

КОМЕНТАРІ • 41

  • @JailadinShaik8897
    @JailadinShaik8897 Місяць тому +1

    well explained and it is recommendable to others also. you have covered multiple things like custom helper and request creation. helpful to me , It has cleared multiple doubts. great efforts.thanks

  • @yakkaya
    @yakkaya 7 місяців тому +1

    Thank you for your clear and explanatory narration. I am looking forward to your new videos on topics like processing XML structures, passport api , Guzzle with api process, Websockets, Redis, and Elasticsearch in Laravel. Thank you a lot!

    • @programmingfields
      @programmingfields  7 місяців тому +2

      Thank you for your valuable feedback and suggestions. I appreciate your valuable time. I will definitely bring videos for all of these suggestions. Please keep connected 🙏🙏

    • @yakkaya
      @yakkaya 7 місяців тому +1

      @@programmingfields thanks a lot

  • @galliavondams6856
    @galliavondams6856 Місяць тому +1

    Can you help for the line "Undefined type log" at 27:11?
    I try to run it but it keep facing error cause of log, and i already try input "\Log::error-" and "use Illuminate\Support\Facades\Log;", but the result is still the same, can you help brother?

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

      @galliavondams6856 The implementation of Log is like this as you said, you already imported the Log facades.
      use Illuminate\Support\Facades\Log;
      public function someMethod()
      {
      try {
      // Some code that could fail
      } catch (\Exception $e) {
      // Log the exception message
      Log::error('Error occurred: ' . $e->getMessage());
      }
      }
      In this case, you will have to check the permissions for the Storage folder in case you are on Linux or Mac system.
      If you could brief more about the errors like what is exactly then I can look into this.

  • @babar178
    @babar178 7 місяців тому +1

    Just subscribed now.congratulation you have got a new subscriber sirr

  • @373323
    @373323 4 місяці тому +1

    awesome, i will watch this a few times, this is good stuff

  • @GianGamingMLBB
    @GianGamingMLBB 7 місяців тому +1

    Very clear explanation! Thank you!

  • @mejiger
    @mejiger 3 місяці тому +1

    well explained! Thanks

  • @ThirunavukkarasuG-i5b
    @ThirunavukkarasuG-i5b 3 місяці тому +1

    Super brother keep going continue same

  • @rohan-d2e
    @rohan-d2e 5 місяців тому +1

    very helpful! thanks! can you provide some details on how to change response of validation errors?

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

      Yes, you can define an array of the validation error messages and according to the validation rules, you can set the custom validation error message.

  • @babar178
    @babar178 7 місяців тому +1

    Wow nice . please can you make video on Laravel Reverb with blade.its very important and we did not find this topic with blade on UA-cam.Thank you

    • @programmingfields
      @programmingfields  7 місяців тому +1

      Sure, I have noted your suggestion. I will make this very soon.

  • @kukun2748
    @kukun2748 Місяць тому +1

    Can you make a multi role using a sanctum? Like admin, manager and user

  • @subhendubaral
    @subhendubaral 3 місяці тому +1

    Thank You

  • @Mahisir2001
    @Mahisir2001 7 місяців тому +1

    Laravel world🔥🔥🔥

  • @sajjadhossainshuvo6975
    @sajjadhossainshuvo6975 3 місяці тому +2

    If I lose my token from the browser's local storage, how can I log out myself?

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

      @@sajjadhossainshuvo6975 If you have stored token in the local storage and somehow it is removed from local storage then you will have to invalidate that API token from server side. So you can revoke the token access.
      You will have the logout API. So simply trigger that it will revoke the previous token access from the backend and it will redirect you to the login page. So that you can regenerate a fresh token.

  • @wisdomkids2024
    @wisdomkids2024 3 місяці тому +1

    very nice

  • @mdsafikulislam9113
    @mdsafikulislam9113 22 дні тому +1

    Hello Brother, How to implement Refresh Token in this project?

    • @programmingfields
      @programmingfields  21 день тому

      @mdsafikulislam9113 In order to Generate both access and refresh tokens during login. Save the refresh token securely.
      1. Create a /refresh-token endpoint to validate the refresh token, revoke old tokens, and issue new ones.
      2. Store refresh tokens securely (e.g., HTTP-only cookies) and handle token expiry on the client to request new access tokens when needed.
      Try the above approach.
      I will create a separate video on that as well.

  • @GameCrawl
    @GameCrawl 7 місяців тому +1

    I think I missed something, I tried to code along and it says createToken is undefined.

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

      Did you try this line?
      // If credentials are incorrect
      if (!Auth::attempt(['email' => $request->email, 'password' => $request->password])) {
      return ResponseHelper::error(message: 'Unable to login due to invalid credentials.', statusCode: 400);
      }
      $user = Auth::user();
      // Create API Token
      $token = $user->createToken('My API Token')->plainTextToken;

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

      You can refer to 36:08

  • @umeshmalisetty6591
    @umeshmalisetty6591 7 місяців тому +1

    I will explain my problem in production
    Can you give suggestions on that…
    When I am inserting bulk data in local for one lakh json data it will take 7 seconds but same thing I did in production 10k also taking 2 min
    I am using sanctum, cors, redis,queues and chunks for insertion

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

      There may be various factors in comparison to local and production server. You can try the below steps-
      1. Check Server Resources:
      - Ensure your production server has enough CPU, RAM, and I/O capacity.
      2. Optimize Database Config:
      - Increase buffer pool size.
      - Use connection pooling.
      - Optimize write-ahead logging.

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

      @@programmingfields Thank you

  • @OngFamily-xi3nc
    @OngFamily-xi3nc 7 місяців тому +1

    Good Laravel api

  • @abrarhasan7177
    @abrarhasan7177 4 місяці тому +1

    I like your video but if your language will hind then its easy to understand me.
    Can you help me?

    • @programmingfields
      @programmingfields  4 місяці тому

      @@abrarhasan7177 That's fine, but I am not using very difficult word and sentence. That is very easy to understand. Please try learning english so it will help in your future growth.

  • @Robennhood
    @Robennhood 3 дні тому +1

    cron job video larawel me