class RefreshCrops extends Command (View source)

Properties

protected $exitCode from  Command
protected string $signature

The name and signature of the console command.

protected string $description

The console command description.

protected DatabaseManager $db
protected string $modelName

The model FQCN for this operation.

protected string $roleName

The role name for this operation.

protected Collection $crops

Available crops for the given model and role name.

protected bool $isDryRun

Print the operations that would be performed without modifying the database.

protected int $cropsCreated

Total number of crops created.

protected int $cropsDeleted

Total number of crops deleted.

protected array $mediaCache

Cache for Media models queried during this operation.

Methods

__call($method, $parameters)

No description

from  Command
handle()

Executes the console command.

__construct(DatabaseManager $db)

No description

void
printSummary()

Print a summary of all crops created and deleted at the end of the command.

void
processMediables(Builder $mediables)

Process a set of mediable items.

void
createCrops(string[] $crops, object $baseItem)

Create missing crops for a given mediable item, preserving existing metadata.

void
deleteCrops(string[] $crops, object $baseItem)

Delete unused crops for a given mediable item.

string|null
locateModel(string $modelName)

Attempt to locate the model from the given command argument.

array
getCropParams(int $mediaId, float $ratio)

Calculate crop params for a media from a given ratio.

Details

__call($method, $parameters)

No description

Parameters

$method
$parameters

handle()

Executes the console command.

__construct(DatabaseManager $db)

No description

Parameters

DatabaseManager $db

protected void printSummary()

Print a summary of all crops created and deleted at the end of the command.

Return Value

void

protected void processMediables(Builder $mediables)

Process a set of mediable items.

Parameters

Builder $mediables

Return Value

void

protected void createCrops(string[] $crops, object $baseItem)

Create missing crops for a given mediable item, preserving existing metadata.

Parameters

string[] $crops

List of crop names to create.

object $baseItem

Base mediable object from which to pull information.

Return Value

void

protected void deleteCrops(string[] $crops, object $baseItem)

Delete unused crops for a given mediable item.

Parameters

string[] $crops

List of crop names to create.

object $baseItem

Base mediable object from which to pull information.

Return Value

void

protected string|null locateModel(string $modelName)

Attempt to locate the model from the given command argument.

Parameters

string $modelName

Return Value

string|null

The model FQCN.

protected array getCropParams(int $mediaId, float $ratio)

Calculate crop params for a media from a given ratio.

Parameters

int $mediaId
float $ratio

Return Value

array