You need to use the class at the top of the file
use App\Mail\MyTestMail;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, i'm currently developing a web project. Yesterday the status issue has been resolved, and now what i want to do is. When the admin click the finish button, it change the status and send an email to the user. But i got this error that said "Class 'Modules\Booking\Controllers\MyTestMail' not found". How do i resolve this??
The Controller :
<?php
namespace Modules\Booking\Controllers;
use App\Notifications\AdminChannelServices;
use App\User;
use App\Mail\MyTestEmail;//tambahan Nicho
use DebugBar\DebugBar;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Mail;//tambahan Nicho
use Mockery\Exception;
//use Modules\Booking\Events\VendorLogPayment;
use Modules\Booking\Events\BookingCreatedEvent;
use Modules\Booking\Events\BookingUpdatedEvent;
use Modules\Booking\Events\EnquirySendEvent;
use Modules\Booking\Events\SetPaidAmountEvent;
use Modules\Tour\Models\TourDate;
use Validator;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Modules\Booking\Models\Booking;
use Modules\Booking\Models\Enquiry;
use App\Helpers\ReCaptchaEngine;
public function finish($id){
$booking = Booking::find($id);
$booking->status = 'Finish';
$booking->save();
$isi_email = [
'title'=>'Thank you for your purchase',
'body'=>'Thank you for your booking. Link : https://youtu.be/dQw4w9WgXcQ'
];
Mail::to('[email protected]')->send(new MyTestMail($isi_email));
return redirect()->back();
}
The Route :
Route::post('/finish/{id}','BookingController@finish')->name('booking.finish');
The Blade file :
@if($booking->status == 'paid')
<form action="{{route('booking.finish', $booking->id)}}" method="POST">
@csrf
<button type="submit" class="btn btn-success">
{{__("Finish")}}
</button>
</form>
@endif
You need to use the class at the top of the file
use App\Mail\MyTestMail;
Please or to participate in this conversation.