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

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ธ.ค. 2024

ความคิดเห็น • 39

  • @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

    • @programmingfields
      @programmingfields  หลายเดือนก่อน

      @@JailadinShaik8897 Thank you very much.

  • @galliavondams6856
    @galliavondams6856 25 วันที่ผ่านมา +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  25 วันที่ผ่านมา

      @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.

  • @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

  • @373323
    @373323 4 หลายเดือนก่อน +1

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

  • @babar178
    @babar178 7 หลายเดือนก่อน +1

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

  • @ThirunavukkarasuG-i5b
    @ThirunavukkarasuG-i5b 2 หลายเดือนก่อน +1

    Super brother keep going continue same

  • @GianGamingMLBB
    @GianGamingMLBB 7 หลายเดือนก่อน +1

    Very clear explanation! Thank you!

  • @mejiger
    @mejiger 2 หลายเดือนก่อน +1

    well explained! Thanks

  • @kukun2748
    @kukun2748 23 วันที่ผ่านมา +1

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

    • @programmingfields
      @programmingfields  6 วันที่ผ่านมา

      @kukun2748 Okay will make a video on this.

  • @Mahisir2001
    @Mahisir2001 7 หลายเดือนก่อน +1

    Laravel world🔥🔥🔥

  • @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.

  • @subhendubaral
    @subhendubaral 3 หลายเดือนก่อน +1

    Thank You

  • @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 TH-cam.Thank you

    • @programmingfields
      @programmingfields  7 หลายเดือนก่อน +1

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

  • @mdsafikulislam9113
    @mdsafikulislam9113 10 วันที่ผ่านมา +1

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

    • @programmingfields
      @programmingfields  10 วันที่ผ่านมา

      @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.

  • @wisdomkids2024
    @wisdomkids2024 3 หลายเดือนก่อน +1

    very nice

  • @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.

  • @OngFamily-xi3nc
    @OngFamily-xi3nc 7 หลายเดือนก่อน +1

    Good Laravel api

  • @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

  • @abrarhasan7177
    @abrarhasan7177 3 หลายเดือนก่อน +1

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

    • @programmingfields
      @programmingfields  3 หลายเดือนก่อน

      @@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.