Silber\Bouncer\Database\IsAbility::makeForModel PHP Метод

makeForModel() публичный статический Метод

Make a new ability for a specific model.
public static makeForModel ( Model | string $model, string | array $attributes ) : static
$model Illuminate\Database\Eloquent\Model | string
$attributes string | array
Результат static
    public static function makeForModel($model, $attributes)
    {
        if (is_string($attributes)) {
            $attributes = ['name' => $attributes];
        }
        if ($model == '*') {
            return (new static())->forceFill($attributes + ['entity_type' => '*']);
        }
        if (is_string($model)) {
            $model = new $model();
        }
        return (new static())->forceFill($attributes + ['entity_type' => $model->getMorphClass(), 'entity_id' => $model->exists ? $model->getKey() : null]);
    }