Member Since 1 Year Ago
4,350 experience to go until the next level!
In case you were wondering, you earn Laracasts experience when you:
Earned once you have completed your first Laracasts lesson.
Earned once you have earned your first 1000 experience points.
Earned when you have been with Laracasts for 1 year.
Earned when you have been with Laracasts for 2 years.
Earned when you have been with Laracasts for 3 years.
Earned when you have been with Laracasts for 4 years.
Earned when you have been with Laracasts for 5 years.
Earned when at least one Laracasts series has been fully completed.
Earned after your first post on the Laracasts forum.
Earned once 100 Laracasts lessons have been completed.
Earned once you receive your first "Best Reply" award on the Laracasts forum.
Earned if you are a paying Laracasts subscriber.
Earned if you have a lifetime subscription to Laracasts.
Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.
Earned once you have achieved 500 forum replies.
Earned once your experience points passes 100,000.
Earned once your experience points hits 10,000.
Earned once 1000 Laracasts lessons have been completed.
Earned once your "Best Reply" award count is 100 or more.
Earned once your experience points passes 1 million.
Earned once your experience points ranks in the top 50 of all Laracasts users.
Earned once your experience points ranks in the top 10 of all Laracasts users.
Replied to Laravel Throw Error Due To Another "From" Email
Hey,
Thanks for reply.
I fixed my issue by using replyTo instead of from. I don't know why, but on Laravel 6 "from" worked
Started a new Conversation Laravel Throw Error Due To Another "From" Email
Hello,
On my website I have a contact form that send two emails:
I want to send to my inbox message from sender email (For direct reply) but laravel throw an error
public function build()
{
return $this->subject('Message de contact')
->from('[email protected]', 'Example')
->view('emails.contactMessage');
}
And I get this error:
message: Expected response code 354 but got code "503", with message "503-All RCPT commands were rejected with this error: 503-Sender verify failed 503 Valid RCPT command must precede DATA "
Edit I fixed my issue using "replyTo" and not "from"
Started a new Conversation Laravel And ICloud / Google Calendar - Some Questions
Hello,
I'm using Fullcalendar for my web app and each event is stored in mysql db. Each customer have his own calendar with own events (Added by this customer)
Now I want to create synch with customers calendars. I want to do this like this:
I would like to know which method is better? Create a new file on each event add / delete or append data to existing file
And I will use this: https://github.com/spatie/laravel-google-calendar
I want also to synch user calendar with my app calendar but is it possible?
Replied to CORS Preflight Issue After Login
Hi, thanks for reply!
I added middleware with Cors. My steps:
Creating cors middleware using php artisan command
I added this code to cors.php file
{
return $next($request)
->header('Access-Control-Allow-Origin', '*')
->header('Header set Access-Control-Allow-Methods', 'GET, POST, PATCH, PUT, DELETE, OPTIONS')
->header('Header set Access-Control-Allow-Headers', 'Origin, Content-Type, X-Auth-Token, Authorization, Accept');
}
And inside kernel.php:
protected $middleware = [
...
\App\Http\Middleware\Cors::class,
...
];
And I have still the same error
Started a new Conversation CORS Preflight Issue After Login
Hello,
I have an app in Laravel and VueJS (Separated). On domain.com I have frontend and on api.domain.com I have all my backend. Yesterday, I spended entire day to find where CORS are not working. Finally I founded solution. I added to my Htaccess file this code:
<IfModule mod.headers. c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, POST, PATCH, PUT, DELETE, OPTIONS"
Header set Access-Control-Allow-Headers "Origin, Content-Type, X-Auth-Token, Authorization, Accept"
</IfModule>
On login page, GET (for check if register is enabled) and POST (for credentials) are not longer blocked by CORS but after success login, everything is blocked and I don't know why
Sending credentials -> Check -> Response 200 with token
When my app is trying to redirect me to dashboard, all requests are blocked by CORS:
Access to XMLHTTPRequest at 'X' from origin 'x' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: redirect is not allowed for a preflight request.
Reason: CORS request external redirect not allowed
Reason: CORS preflight response did not succeed
Reason: CORS request did not succeed
I don't know what I'm doing wrong. All responses from my controller are set to 200
Replied to Do I Understand Correctly Policies?
@sinnbeck Ok, thanks you again. Only logged users can access this page. Once logged, they get list of students where user_id === logged user id. I think it's not necessary to use policies.
Replied to Do I Understand Correctly Policies?
@sinnbeck Thank you very much for your reply, very helpful!
I have juste another very quick question. If I'm using auth user id for data retrieve, I also need to make validation for them? For exemple:
Students::where('teacher_id', request()->user()->id)-get();
?
Started a new Conversation Do I Understand Correctly Policies?
Hello,
I started using policies but I don't know if I understand correctly policies "schema"
So,
Post::class => PostPolicy::class
This code allow to use policies inside Post controller or which model use/refer to which policy?
public function view(User $user, Post $post)
02a. Param inside view function refer to models? Or data come from controller, (Autorize)? 02b. Can I add more params?
03.Inside controller file, view function:
$this->authorize('view', Post::class)
Post:Class is used to find correct policy? (Post -> PostPolicy -> view function inside policy)?
Started a new Conversation Additional Data In Sanctum - Work And Throw An Error At The Same Time
Hello,
I'm trying to additional data for sanctum (IP adress). Everything work fine (Sanctum create token, save it to db etc) but throw an error a the same time.
How I add data:
Creation of model PersonalAccessTokens with protected filable.
Adding inside AppServiceProvider in boot function: Sanctum::usePersonalAccessTokenModel('App\PersonalAccessTokens');
Adding inside User model:
public function createToken(string $name, array $abilities = ['*']) { $token = $this->tokens()->create([ 'name' => $name, 'ip_address' => request()->ip(), 'token' => hash('sha256', $plainTextToken = Str::random(80)), 'abilities' => $abilities, ]); return new NewAccessToken($token, $token->id.'|'.$plainTextToken); }
4.Creation of token using:
$token = $user->createToken($request->device_name)->plainTextToken;
Sanctum add data to DB (token, ip, etc) but throw also this error:
Argument 1 passed to Laravel\Sanctum\NewAccessToken::__construct() must be an instance of Laravel\Sanctum\PersonalAccessToken, instance of App\PersonalAccessTokens given, called in
Replied to Storing Additional Data In Sanctum
Thanks for reply!
I want to use these data in "active session" tab inside my app. When user log in, vue check browser, ip and device. After that, axios join these data to post request with credentials.
Started a new Conversation Storing Additional Data In Sanctum
Hello,
I have a quick question about Sanctum.
I want to add additional data to Sanctum:
I'm sending everything using post from my frontend (Token, credentials, device type etc).
Which file inside Laravel get all data and transfer it to the DB?