Skip to content

Instantly share code, notes, and snippets.

View SlimGee's full-sized avatar

Given Ncube SlimGee

View GitHub Profile
@SlimGee
SlimGee / gist:3b870d1f6be9f9b9bdc2f15b2f221a34
Last active June 20, 2024 19:15
Laravel rails like respond_to
//AppServiceProvider
/**
* Bootstrap any application services.
*/
public function boot(): void
{
ResponseFactory::macro('to', function (Closure $callback): mixed {
throw_unless($callback, NotFoundHttpException::class);