2022-10-24 01:04:22 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Traits;
|
|
|
|
|
|
|
|
use Illuminate\Http\RedirectResponse;
|
|
|
|
|
|
|
|
trait DisablesFeatures
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Checks if demo mode is active. If so, it stops any more logic from running.
|
|
|
|
*
|
|
|
|
* @return RedirectResponse|null
|
|
|
|
*/
|
|
|
|
protected function disable(): RedirectResponse|null
|
|
|
|
{
|
|
|
|
if (config('demo.is_enabled')) {
|
|
|
|
return redirect()
|
|
|
|
->back()
|
|
|
|
->with('error', __('This feature is disabled'));
|
|
|
|
}
|
2023-01-15 00:04:00 +00:00
|
|
|
|
2022-10-24 01:04:22 +01:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|