This commit is contained in:
2023-11-27 08:29:48 +10:00
parent c432b32d08
commit 0772010119
195 changed files with 7153 additions and 9787 deletions

View File

@@ -0,0 +1,71 @@
<?php
namespace App\Conductors;
use Illuminate\Database\Eloquent\Model;
class AnalyticsConductor extends Conductor
{
/**
* The Model Class
* @var string
*/
protected $class = \App\Models\AnalyticsSession::class;
/**
* The default includes to include in a request.
*
* @var array
*/
protected $includes = ['requests.type','requests.path'];
/**
* Return if the current model is visible.
*
* @param Model $model The model.
* @return boolean Allow model to be visible.
*/
public static function viewable(Model $model): bool
{
/** @var \App\Models\User */
$user = auth()->user();
return ($user !== null && $user->hasPermission('admin/analytics') === true);
}
/**
* Return if the current model is creatable.
*
* @return boolean Allow creating model.
*/
public static function creatable(): bool
{
return true;
}
/**
* Return if the current model is updatable.
*
* @param Model $model The model.
* @return boolean Allow updating model.
*/
public static function updatable(Model $model): bool
{
/** @var \App\Models\User */
$user = auth()->user();
return ($user !== null && $user->hasPermission('admin/analytics') === true);
}
/**
* Return if the current model is destroyable.
*
* @param Model $model The model.
* @return boolean Allow deleting model.
*/
public static function destroyable(Model $model): bool
{
/** @var \App\Models\User */
$user = auth()->user();
return ($user !== null && $user->hasPermission('admin/analytics') === true);
}
}