Skip to content

Instantly share code, notes, and snippets.

@cursosdesarrolloweb
Created Jul 22, 2021
Embed
What would you like to do?
<?php
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