2019-11-04 01:22:59 +01:00
< ? php
/**
2020-09-06 11:38:10 +02:00
* Invoice Ninja ( https :// invoiceninja . com ) .
2019-11-04 01:22:59 +01:00
*
* @ link https :// github . com / invoiceninja / invoiceninja source repository
*
2021-01-03 22:54:54 +01:00
* @ copyright Copyright ( c ) 2021. Invoice Ninja LLC ( https :// invoiceninja . com )
2019-11-04 01:22:59 +01:00
*
* @ license https :// opensource . org / licenses / AAL
*/
namespace App\Http\Middleware ;
use Closure ;
2020-10-28 11:10:49 +01:00
use Illuminate\Http\Request ;
2019-11-04 01:22:59 +01:00
class ClientPortalEnabled
{
/**
* Handle an incoming request .
*
2020-10-28 11:10:49 +01:00
* @ param Request $request
* @ param Closure $next
2019-11-04 01:22:59 +01:00
* @ return mixed
*/
public function handle ( $request , Closure $next )
{
2019-12-30 22:59:12 +01:00
if ( auth () -> user () -> client -> getSetting ( 'enable_client_portal' ) === false ) {
2021-05-11 03:55:47 +02:00
return redirect () -> route ( 'client.error' ) -> with ([ 'title' => ctrans ( 'texts.client_portal' ), 'notification' => 'This section of the app has been disabled by the administrator.' ]);
2019-12-30 22:59:12 +01:00
}
2019-11-04 01:22:59 +01:00
return $next ( $request );
}
}