Download app/Http/Middleware/hasImageTokens.php from pnacorp/magicai: direct link, hf CLI and curl.
- Browser
- Download file 668 Bytes
-
https://huggingface.co/pnacorp/magicai/resolve/main/app/Http/Middleware/hasImageTokens.php
- Command line
-
hf download hf://pnacorp/magicai/app/Http/Middleware/hasImageTokens.php
-
curl -L -o hasImageTokens.php https://huggingface.co/pnacorp/magicai/resolve/main/app/Http/Middleware/hasImageTokens.php
668 Bytes
| namespace App\Http\Middleware; | |
| use Closure; | |
| use Illuminate\Http\Request; | |
| use Illuminate\Support\Facades\Auth; | |
| use Symfony\Component\HttpFoundation\Response; | |
| class hasImageTokens | |
| { | |
| /** | |
| * Handle an incoming request. | |
| * | |
| * @param Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next | |
| */ | |
| public function handle(Request $request, Closure $next): Response | |
| { | |
| if (Auth::user()->remaining_images == -1 or Auth::user()->remaining_images > 0) { | |
| return $next($request); | |
| } | |
| return back()->with(['message' => 'Insufficient credits to create.', 'type' => 'error']); | |
| } | |
| } | |