Skip to main content

After the First Client Review

Premium
16 min read

Comments & Discussion

A
Alexey ✓ Link copied!

Hello. Some questions / corrections:

  1. app/Http/Controllers/CompanyUser (Guide) Controller.php: RegistrationInvite but not UserRegistrationInvite.
  2. app/Http/Controllers/Auth/RegisteredUserController.php: but not app/Http/Controllers/RegisteredUserController.php:
  3. Actually do we need edit scenario for users (guides)? For what we may edit an email in this way? If not we need to change / remove "update requests files" and it's methods in controllers.
M
marcelo-kazalukian ✓ Link copied!

Hello. I think in the function test_company_owner_can_send_invite_to_user the line $user = User::factory()->admin()->create(); should be $user = User::factory()->companyOwner()->create(); is this correct? Thanks.

M
marcelo-kazalukian ✓ Link copied!

same in the function test_company_owner_can_send_invite_to_guide_to_his_company

N
Nerijus ✓ Link copied!

Thanks. Updated the lesson.

M
marcelo-kazalukian ✓ Link copied!

Hello. I think in the function test_company_owner_can_send_invite_to_user the line

$user = User::factory()->companyOwner()->create(); should be $user = User::factory()->companyOwner()->create(['company_id' => $company->id]);

if not, then in this line, the user doesn't have the same company $response->assertRedirect(route('companies.users.index', $company->id));

N
Nerijus ✓ Link copied!

In this case it doesn't matter because we test different thing. But for consistency yes it would be better. Updated the lesson.

J
jwinder ✓ Link copied!

Yeah i noticed same thing i had to switch it like this for company owner

$response = $this->actingAs($companyOwner)->post(route('companies.users.store', $company->id), [
'email' => 'test@test.com'
]);
 
$response->assertRedirect(route('companies.users.index', $company->id));
 
// checks if mailable of type UserRegistrationInvite was sent from above line of code
Mail::assertSent(UserRegistrationInvite::class);
HV
Hugo Viergever ✓ Link copied!

"And the invitation email is now sent..." But I'm affraid I get an error here: Connection could not be established with host "mailpit:1025": stream_socket_client(): php_network_getaddresses: getaddrinfo for mailpit failed: Host is onbekend. / Is it necessary to register with mailgun.org? Can this be the reason for the failure? Thank you for the reply!

PK
Povilas Korop ✓ Link copied!

You need to use some email provider to send email, yes. It could be Mailgun or similar for real emails, or Mailpit/Mailtrap for fake emails. And yes, that's the reason for the failure.

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.