ce que vous utilisez est avisé par mail, voici la réponse, mais vous pouvez vous référer à la section de notification de Laravel docs pour plus d'informations:
https://laravel.com/docs/5.4/notifications
première notification à l'aide de la générer de votre terminal dans le dossier du projet:
php make artisan: notification UserInvite
Ensuite, dans le fichier généré indiquer votre pilote à 'Mail'
. byr par défaut c'est. Laravel a aussi un bon exemple de code. Et il vaut mieux injecter votre $ invitation à la notification afin que vous puissiez l'utiliser là. Voici un exemple de code rapide. Vous pouvez trouver la notification générée sous App \ Notifications.
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use App\Invite;
class UserInvite extends Notification implements ShouldQueue
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct()
{
//
}
public function via($notifiable)
{
return ['mail']; // Here you specify your driver, your case is Mail
}
public function toMail($notifiable)
{
return (new MailMessage)
->greeting('Your greeting comes here')
->line('The introduction to the notification.') //here is your lines in email
->action('Notification Action', url('/')) // here is your button
->line("You can use {$notifiable->token}"); // another line and you can add many lines
}
}
maintenant, vous pouvez appeler votre notification:
$invite->notify(new UserInvite());
puisque vous notifiez sur invitation, votre déclaration est la même invitation. Par conséquent, dans votre notification, vous pouvez utiliser $notification->token
pour récupérer le jeton invite object
.
S'il vous plaît laissez-moi savoir si je peux être de toute aide. ce qui concerne.
Utilisez-vous laravel 5.4? –
Tout ce dont vous avez besoin se trouve sur https://laravel.com/docs/5.4/mail – ceejayoz