Skip to content

Instantly share code, notes, and snippets.

@cursosdesarrolloweb
Created July 22, 2021 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cursosdesarrolloweb/e4bb5638c0dfc656af18ae7b51c8325b to your computer and use it in GitHub Desktop.
Save cursosdesarrolloweb/e4bb5638c0dfc656af18ae7b51c8325b to your computer and use it in GitHub Desktop.
<?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