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
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?
@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.
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!
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 🙏🙏
@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.
@@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.
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;
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
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.
@@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.
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
@@JailadinShaik8897 Thank you very much.
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?
@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.
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!
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 🙏🙏
@@programmingfields thanks a lot
awesome, i will watch this a few times, this is good stuff
Glad to hear.
Just subscribed now.congratulation you have got a new subscriber sirr
Super brother keep going continue same
Thank you so much.
Very clear explanation! Thank you!
You're welcome 😊
well explained! Thanks
Can you make a multi role using a sanctum? Like admin, manager and user
@kukun2748 Okay will make a video on this.
Laravel world🔥🔥🔥
☺️☺️
very helpful! thanks! can you provide some details on how to change response of validation errors?
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.
Thank You
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
Sure, I have noted your suggestion. I will make this very soon.
Hello Brother, How to implement Refresh Token in this project?
@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.
very nice
If I lose my token from the browser's local storage, how can I log out myself?
@@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.
Good Laravel api
Thank you 😊
I think I missed something, I tried to code along and it says createToken is undefined.
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;
You can refer to 36:08
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
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.
@@programmingfields Thank you
I like your video but if your language will hind then its easy to understand me.
Can you help me?
@@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.