I\'m noob in Laravel and working with Laravel 5. For user registration and and login, I want to use default system of laravel. But, need to extend it with two following feat
Laravel has an empty method named registered in Illuminate\Foundation\Auth\RegistersUsers trait to simplify this operation, just override it as following:
First add a new Notification:
user = $user;
}
public function via($notifiable) {
return ['mail'];
}
public function toMail($notifiable) {
return (new MailMessage)
->success()
->subject('Welcome')
->line('Dear ' . $this->user->name . ', we are happy to see you here.')
->action('Go to site', url('/'))
->line('Please tell your friends about us.');
}
}
Add this use line to your RegisterController.php:
use Illuminate\Http\Request;
use App\Notifications\UserRegisteredNotification;
and add this method:
protected function registered(Request $request, $user) {
$user->notify(new UserRegisteredNotification($user));
}
You are done.