error
App\\Services\\Notification\\Notification::sendEmail(): Argument #2 ($mailable) must be of type Illuminate\\support\\Mailable, App\\Mail\\TopicCreated given, called in C:\\Users\\afrav\\Notification\\routes\\web.php on line 23
php
namespace
App\\Mail;
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 TopicCreated extends Mailable
{
use Queueable, SerializesModels;
private $first_name;
private $last_name;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct()
{
$this->first_name = 'mosy';
$this->last_name = ' afravi';
}
/**
* Get the message envelope.
*
* @return \\Illuminate\\Mail\\Mailables\\Envelope
*/
public function envelope()
{
return new Envelope(
subject: 'Topic Created',
);
}
/**
* Get the message content definition.
*
* @return \\Illuminate\\Mail\\Mailables\\Content
*/
public function content()
{
return new Content(
view:'emails.topic-created',
with:([
'full_name'=>$this->first_name . $this->last_name
]),
);
}
/**
* Get the attachments for the message.
*
* @return array
*/
public function attachments()
{
return [];
}
}
/////////////////////////////////////
use App\\Services\\Notification\\Notification;
use Illuminate\\Support\\Facades\\Route;
use App\\Mail\\TopicCreated;
use App\\Models\\User;
use App\\Mail\\UserRegistered;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
$notification = resolve(Notification::class);
$notification->sendEmail(User::find(1) , new TopicCreated);
});