40 lines
772 B
PHP
40 lines
772 B
PHP
<?php
|
|
|
|
namespace App\Setting;
|
|
|
|
use Lorisleiva\Actions\ActionRequest;
|
|
use Spatie\LaravelSettings\Settings;
|
|
|
|
abstract class LocalSettings extends Settings
|
|
{
|
|
abstract public static function title(): string;
|
|
|
|
public function url(): string
|
|
{
|
|
return route('setting.view', ['settingGroup' => $this->group()]);
|
|
}
|
|
|
|
public function storeUrl(): string
|
|
{
|
|
return $this->url();
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
abstract public function viewData(): array;
|
|
|
|
public function beforeSave(ActionRequest $request): void
|
|
{
|
|
return;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function saveAttributes(ActionRequest $request): array
|
|
{
|
|
return $request->validated();
|
|
}
|
|
}
|