Separated laravel app to its own folder (#540)
This commit is contained in:
31
api/app/Http/Middleware/IsSubscribed.php
Normal file
31
api/app/Http/Middleware/IsSubscribed.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class IsSubscribed
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if ($request->user() && ! $request->user()->subscribed()) {
|
||||
// This user is not a paying customer...
|
||||
if ($request->expectsJson()) {
|
||||
return response([
|
||||
'message' => 'You are not subscribed to NotionForms Pro.',
|
||||
'type' => 'error',
|
||||
], 401);
|
||||
}
|
||||
|
||||
return redirect('billing');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user