Download app/Providers/MacrosServiceProvider.php from pnacorp/magicai: direct link, hf CLI and curl.
- Browser
- Download file 948 Bytes
-
https://huggingface.co/pnacorp/magicai/resolve/main/app/Providers/MacrosServiceProvider.php
- Command line
-
hf download hf://pnacorp/magicai/app/Providers/MacrosServiceProvider.php
-
curl -L -o MacrosServiceProvider.php https://huggingface.co/pnacorp/magicai/resolve/main/app/Providers/MacrosServiceProvider.php
948 Bytes
| namespace App\Providers; | |
| use Illuminate\Routing\ResponseFactory; | |
| use Illuminate\Support\ServiceProvider; | |
| class MacrosServiceProvider extends ServiceProvider | |
| { | |
| public function register(): void | |
| { | |
| $this->registerResponseFactoryMacro(); | |
| } | |
| public function boot(): void | |
| { | |
| // | |
| } | |
| private function registerResponseFactoryMacro(): void | |
| { | |
| ResponseFactory::macro( | |
| 'success', | |
| fn (string $message, array $data = []) => $this->json([ | |
| 'status' => 'success', | |
| 'message' => $message, | |
| 'data' => $data, | |
| ]) | |
| ); | |
| ResponseFactory::macro( | |
| 'error', | |
| function (string $message, ?int $statusCode = 422) { | |
| return $this->json([ | |
| 'status' => 'error', | |
| 'message' => $message, | |
| ], $statusCode); | |
| }); | |
| } | |
| } | |