Skip to content

Instantly share code, notes, and snippets.

Created Jul 22, 2021
What would you like to do?
use App\Events\NewOrder;
use App\Models\Order;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Event;
Route::get("/order/process", function () {
$order = Order::create([
"user_id" => auth()->id(),
"amount" => 99.9,
"status" => OrderStatus::Processed,
"created_at" => now(),
Event::dispatch(new NewOrder($order));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment