Download core/app/Http/Middleware/AuthorMiddleware.php from pnacorp/codeplus: direct link, hf CLI and curl.
- Browser
- Download file 778 Bytes
-
https://huggingface.co/pnacorp/codeplus/resolve/main/core/app/Http/Middleware/AuthorMiddleware.php
- Command line
-
hf download hf://pnacorp/codeplus/core/app/Http/Middleware/AuthorMiddleware.php
-
curl -L -o AuthorMiddleware.php https://huggingface.co/pnacorp/codeplus/resolve/main/core/app/Http/Middleware/AuthorMiddleware.php
778 Bytes
| namespace App\Http\Middleware; | |
| use Closure; | |
| use Illuminate\Http\Request; | |
| class AuthorMiddleware | |
| { | |
| /** | |
| * Handle an incoming request. | |
| * | |
| * @param \Illuminate\Http\Request $request | |
| * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next | |
| * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse | |
| */ | |
| public function handle(Request $request, Closure $next) | |
| { | |
| if (auth()->check() && auth()->user()->is_author === 0) { | |
| $notify[] = ['error', 'You are not an author. For being an author, please provide these information']; | |
| return to_route('user.author.form')->withNotify($notify); | |
| } | |
| return $next($request); | |
| } | |
| } | |