This commit refactors the import statements in various controllers and jobs to improve code organization and readability. Unused imports were removed, and necessary imports were added to ensure proper functionality.
36 lines
919 B
PHP
36 lines
919 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Traits\Controllers;
|
|
|
|
use App\Contracts\Executor;
|
|
use App\Cqs\Actions\Common\ToggleModelStar;
|
|
use App\Cqs\Actions\Common\ToggleModelStarInput;
|
|
use App\Interfaces\ModelWithStar;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @mixin \Illuminate\Routing\Controller
|
|
*/
|
|
trait TogglesModelStar
|
|
{
|
|
/**
|
|
* Toggles model star
|
|
*/
|
|
public function toggleStar(
|
|
Model & ModelWithStar $model,
|
|
ToggleModelStar $action,
|
|
Executor $executor
|
|
): RedirectResponse {
|
|
$this->authorize('toggleStar', $model);
|
|
|
|
$executor->execute($action, new ToggleModelStarInput($model));
|
|
|
|
return back()->with('success', trans('crud.messages.has_been_updated', [
|
|
'model' => Str::ucfirst(trans_choice('models.classes.' . $model->getTable(), 1)),
|
|
]));
|
|
}
|
|
}
|