- Story 1.1: Permission enum, config, AuthorizesPermissions & HasWorkspaceScope traits, member→worker migration - Story 1.2: Team page with member list, invitation system with queued email - Story 1.3: Role assignment (Manager/Worker) and member removal with activity logging - Story 1.4: Owner-only permission toggle matrix for Managers (manage team, view logs, configure portal) - Story 1.5: Role-based access enforcement — Workers see only assigned declarations/clients, sidebar scoping - Story 1.6: Workspace switcher dropdown for multi-workspace users with session-based switching - 83 new/modified files, 182 tests passing with zero regressions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57 lines
1.5 KiB
PHP
57 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use App\Models\TeamInvitation;
|
|
use App\Models\Workspace;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class TeamInvitationMail extends Mailable implements ShouldQueue
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
/**
|
|
* Create a new message instance.
|
|
*/
|
|
public function __construct(
|
|
public Workspace $workspace,
|
|
public TeamInvitation $invitation
|
|
) {}
|
|
|
|
/**
|
|
* Get the message envelope.
|
|
*/
|
|
public function envelope(): Envelope
|
|
{
|
|
return new Envelope(
|
|
subject: 'Invitation à rejoindre '.$this->workspace->name,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the message content definition.
|
|
*/
|
|
public function content(): Content
|
|
{
|
|
$roleLabels = [
|
|
'manager' => 'Gestionnaire',
|
|
'worker' => 'Collaborateur',
|
|
];
|
|
|
|
return new Content(
|
|
markdown: 'emails.team-invitation',
|
|
with: [
|
|
'workspaceName' => $this->workspace->name,
|
|
'roleLabel' => $roleLabels[$this->invitation->role] ?? $this->invitation->role,
|
|
'registerUrl' => route('register', ['invitation' => $this->invitation->token]),
|
|
'expiresAt' => $this->invitation->expires_at->format('d/m/Y à H:i'),
|
|
]
|
|
);
|
|
}
|
|
}
|