2022-10-20 02:15:28 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Setting;
|
|
|
|
|
2024-08-01 17:30:55 +02:00
|
|
|
use Lorisleiva\Actions\ActionRequest;
|
2022-10-20 02:15:28 +02:00
|
|
|
use Spatie\LaravelSettings\Settings;
|
|
|
|
|
|
|
|
abstract class LocalSettings extends Settings
|
|
|
|
{
|
|
|
|
abstract public static function title(): string;
|
|
|
|
|
2024-08-01 13:33:28 +02:00
|
|
|
public function url(): string
|
2022-10-20 02:15:28 +02:00
|
|
|
{
|
2024-08-01 13:33:28 +02:00
|
|
|
return route('setting.view', ['settingGroup' => $this->group()]);
|
2022-10-20 02:15:28 +02:00
|
|
|
}
|
2024-08-01 11:32:14 +02:00
|
|
|
|
2024-08-01 17:30:55 +02:00
|
|
|
public function storeUrl(): string
|
|
|
|
{
|
|
|
|
return $this->url();
|
|
|
|
}
|
|
|
|
|
2024-08-01 11:32:14 +02:00
|
|
|
/**
|
2024-08-01 18:25:25 +02:00
|
|
|
* @return mixed
|
2024-08-01 11:32:14 +02:00
|
|
|
*/
|
2024-08-01 18:25:25 +02:00
|
|
|
public function data()
|
|
|
|
{
|
2024-08-02 13:16:43 +02:00
|
|
|
return [
|
|
|
|
'data' => $this->toArray(),
|
|
|
|
'meta' => [
|
|
|
|
'links' => [
|
|
|
|
'store' => $this->storeUrl(),
|
|
|
|
]
|
|
|
|
]
|
|
|
|
];
|
2024-08-01 18:25:25 +02:00
|
|
|
}
|
2024-08-01 17:30:55 +02:00
|
|
|
|
|
|
|
public function beforeSave(ActionRequest $request): void
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array<string, mixed>
|
|
|
|
*/
|
|
|
|
public function saveAttributes(ActionRequest $request): array
|
|
|
|
{
|
|
|
|
return $request->validated();
|
|
|
|
}
|
2022-10-20 02:15:28 +02:00
|
|
|
}
|