Add settings module: Implemented SettingResource with CRUD pages, schemas, and models for managing application settings. Added localization support for settings, including navigation labels, form fields, and table columns. Integrated soft delete functionality and optimized query handling for settings retrieval.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Admin\Resources\Settings\Pages;
|
||||
|
||||
use App\Filament\Admin\Resources\Settings\SettingResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSetting extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SettingResource::class;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('settings.create');
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
|
||||
protected function getCreatedNotificationTitle(): ?string
|
||||
{
|
||||
return __('settings.created_successfully');
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
// Boolean değerleri string'e çevir
|
||||
if (isset($data['type']) && $data['type'] === 'boolean') {
|
||||
$data['value'] = $data['value'] ? '1' : '0';
|
||||
}
|
||||
|
||||
// Integer değerleri string'e çevir
|
||||
if (isset($data['type']) && $data['type'] === 'integer') {
|
||||
$data['value'] = (string) $data['value'];
|
||||
}
|
||||
|
||||
// Float değerleri string'e çevir
|
||||
if (isset($data['type']) && $data['type'] === 'float') {
|
||||
$data['value'] = (string) $data['value'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Admin\Resources\Settings\Pages;
|
||||
|
||||
use App\Filament\Admin\Resources\Settings\SettingResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\ForceDeleteAction;
|
||||
use Filament\Actions\RestoreAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSetting extends EditRecord
|
||||
{
|
||||
protected static string $resource = SettingResource::class;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('settings.edit');
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make()
|
||||
->label(__('settings.delete')),
|
||||
RestoreAction::make()
|
||||
->label(__('settings.restore')),
|
||||
ForceDeleteAction::make()
|
||||
->label(__('settings.force_delete')),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
|
||||
protected function getSavedNotificationTitle(): ?string
|
||||
{
|
||||
return __('settings.updated_successfully');
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeFill(array $data): array
|
||||
{
|
||||
// Boolean tipindeki değerleri cast et
|
||||
if (isset($data['type']) && $data['type'] === 'boolean') {
|
||||
$data['value'] = filter_var($data['value'], FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
// Integer tipindeki değerleri cast et
|
||||
if (isset($data['type']) && $data['type'] === 'integer') {
|
||||
$data['value'] = (int) $data['value'];
|
||||
}
|
||||
|
||||
// Float tipindeki değerleri cast et
|
||||
if (isset($data['type']) && $data['type'] === 'float') {
|
||||
$data['value'] = (float) $data['value'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
// Boolean değerleri string'e çevir
|
||||
if (isset($data['type']) && $data['type'] === 'boolean') {
|
||||
$data['value'] = $data['value'] ? '1' : '0';
|
||||
}
|
||||
|
||||
// Integer değerleri string'e çevir
|
||||
if (isset($data['type']) && $data['type'] === 'integer') {
|
||||
$data['value'] = (string) $data['value'];
|
||||
}
|
||||
|
||||
// Float değerleri string'e çevir
|
||||
if (isset($data['type']) && $data['type'] === 'float') {
|
||||
$data['value'] = (string) $data['value'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Admin\Resources\Settings\Pages;
|
||||
|
||||
use App\Filament\Admin\Resources\Settings\SettingResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSettings extends ListRecords
|
||||
{
|
||||
protected static string $resource = SettingResource::class;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('settings.title');
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->label(__('settings.create')),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Admin\Resources\Settings\Schemas;
|
||||
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Components\Utilities\Set;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class SettingForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Section::make(__('settings.title'))
|
||||
->schema([
|
||||
TextInput::make('key')
|
||||
->label(__('settings.key'))
|
||||
->helperText(__('settings.key_helper'))
|
||||
->required()
|
||||
->unique(ignoreRecord: true)
|
||||
->regex('/^[a-z0-9_-]+$/')
|
||||
->maxLength(255)
|
||||
->disabled(fn ($record) => $record !== null)
|
||||
->columnSpanFull(),
|
||||
|
||||
TextInput::make('label')
|
||||
->label(__('settings.label'))
|
||||
->helperText(__('settings.label_helper'))
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->columnSpanFull(),
|
||||
|
||||
Textarea::make('description')
|
||||
->label(__('settings.description'))
|
||||
->helperText(__('settings.description_helper'))
|
||||
->rows(3)
|
||||
->columnSpanFull(),
|
||||
|
||||
Select::make('type')
|
||||
->label(__('settings.type'))
|
||||
->helperText(__('settings.type_helper'))
|
||||
->required()
|
||||
->options([
|
||||
'string' => __('settings.type_string'),
|
||||
'text' => __('settings.type_text'),
|
||||
'boolean' => __('settings.type_boolean'),
|
||||
'integer' => __('settings.type_integer'),
|
||||
'float' => __('settings.type_float'),
|
||||
'array' => __('settings.type_array'),
|
||||
'json' => __('settings.type_json'),
|
||||
])
|
||||
->live()
|
||||
->afterStateUpdated(fn (Set $set) => $set('value', null)),
|
||||
|
||||
Select::make('group')
|
||||
->label(__('settings.group'))
|
||||
->helperText(__('settings.group_helper'))
|
||||
->required()
|
||||
->options([
|
||||
'general' => __('settings.group_general'),
|
||||
'email' => __('settings.group_email'),
|
||||
'seo' => __('settings.group_seo'),
|
||||
'social' => __('settings.group_social'),
|
||||
'security' => __('settings.group_security'),
|
||||
'payment' => __('settings.group_payment'),
|
||||
'notification' => __('settings.group_notification'),
|
||||
'other' => __('settings.group_other'),
|
||||
])
|
||||
->default('general'),
|
||||
|
||||
Textarea::make('value')
|
||||
->label(__('settings.value'))
|
||||
->helperText(__('settings.value_helper'))
|
||||
->required()
|
||||
->visible(fn (Get $get) => !in_array($get('type'), ['boolean']))
|
||||
->rows(fn (Get $get) => $get('type') === 'text' ? 5 : 3)
|
||||
->columnSpanFull(),
|
||||
|
||||
Toggle::make('value')
|
||||
->label(__('settings.value'))
|
||||
->helperText(__('settings.value_helper'))
|
||||
->required()
|
||||
->visible(fn (Get $get) => $get('type') === 'boolean')
|
||||
->columnSpanFull(),
|
||||
|
||||
Toggle::make('is_active')
|
||||
->label(__('settings.is_active'))
|
||||
->helperText(__('settings.is_active_helper'))
|
||||
->default(true)
|
||||
->columnSpan(1),
|
||||
|
||||
Toggle::make('is_public')
|
||||
->label(__('settings.is_public'))
|
||||
->helperText(__('settings.is_public_helper'))
|
||||
->default(false)
|
||||
->columnSpan(1),
|
||||
])
|
||||
->columns(2),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Admin\Resources\Settings;
|
||||
|
||||
use App\Filament\Admin\Resources\Settings\Pages\CreateSetting;
|
||||
use App\Filament\Admin\Resources\Settings\Pages\EditSetting;
|
||||
use App\Filament\Admin\Resources\Settings\Pages\ListSettings;
|
||||
use App\Filament\Admin\Resources\Settings\Schemas\SettingForm;
|
||||
use App\Filament\Admin\Resources\Settings\Tables\SettingsTable;
|
||||
use App\Models\Setting;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use UnitEnum;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class SettingResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Setting::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::Cog6Tooth;
|
||||
|
||||
protected static UnitEnum|string|null $navigationGroup = 'Sistem';
|
||||
|
||||
protected static ?int $navigationSort = 100;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('settings.navigation_label');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('settings.model_label');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('settings.plural_model_label');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return SettingForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return SettingsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListSettings::route('/'),
|
||||
'create' => CreateSetting::route('/create'),
|
||||
'edit' => EditSetting::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Admin\Resources\Settings\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\ForceDeleteAction;
|
||||
use Filament\Actions\ForceDeleteBulkAction;
|
||||
use Filament\Actions\RestoreAction;
|
||||
use Filament\Actions\RestoreBulkAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Filters\TrashedFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SettingsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('key')
|
||||
->label(__('settings.table_key'))
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('label')
|
||||
->label(__('settings.table_label'))
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('value')
|
||||
->label(__('settings.table_value'))
|
||||
->searchable()
|
||||
->limit(50)
|
||||
->wrap(),
|
||||
|
||||
TextColumn::make('type')
|
||||
->label(__('settings.table_type'))
|
||||
->badge()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'boolean' => 'success',
|
||||
'integer', 'float' => 'info',
|
||||
'array', 'json' => 'warning',
|
||||
default => 'gray',
|
||||
})
|
||||
->formatStateUsing(fn (string $state): string => __("settings.type_{$state}")),
|
||||
|
||||
TextColumn::make('group')
|
||||
->label(__('settings.table_group'))
|
||||
->badge()
|
||||
->color('primary')
|
||||
->formatStateUsing(fn (string $state): string => __("settings.group_{$state}")),
|
||||
|
||||
IconColumn::make('is_active')
|
||||
->label(__('settings.table_active'))
|
||||
->boolean()
|
||||
->sortable(),
|
||||
|
||||
IconColumn::make('is_public')
|
||||
->label(__('settings.table_public'))
|
||||
->boolean()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->label(__('settings.table_created_at'))
|
||||
->dateTime('d.m.Y H:i')
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
|
||||
TextColumn::make('updated_at')
|
||||
->label(__('settings.table_updated_at'))
|
||||
->dateTime('d.m.Y H:i')
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('group')
|
||||
->label(__('settings.filter_group'))
|
||||
->options([
|
||||
'general' => __('settings.group_general'),
|
||||
'email' => __('settings.group_email'),
|
||||
'seo' => __('settings.group_seo'),
|
||||
'social' => __('settings.group_social'),
|
||||
'security' => __('settings.group_security'),
|
||||
'payment' => __('settings.group_payment'),
|
||||
'notification' => __('settings.group_notification'),
|
||||
'other' => __('settings.group_other'),
|
||||
]),
|
||||
|
||||
SelectFilter::make('type')
|
||||
->label(__('settings.filter_type'))
|
||||
->options([
|
||||
'string' => __('settings.type_string'),
|
||||
'text' => __('settings.type_text'),
|
||||
'boolean' => __('settings.type_boolean'),
|
||||
'integer' => __('settings.type_integer'),
|
||||
'float' => __('settings.type_float'),
|
||||
'array' => __('settings.type_array'),
|
||||
'json' => __('settings.type_json'),
|
||||
]),
|
||||
|
||||
TernaryFilter::make('is_active')
|
||||
->label(__('settings.filter_active'))
|
||||
->boolean()
|
||||
->trueLabel(__('settings.is_active'))
|
||||
->falseLabel(__('settings.is_active') . ' (Hayır)'),
|
||||
|
||||
TernaryFilter::make('is_public')
|
||||
->label(__('settings.filter_public'))
|
||||
->boolean()
|
||||
->trueLabel(__('settings.is_public'))
|
||||
->falseLabel(__('settings.is_public') . ' (Hayır)'),
|
||||
|
||||
TrashedFilter::make(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
RestoreAction::make(),
|
||||
ForceDeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
RestoreBulkAction::make(),
|
||||
ForceDeleteBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->defaultSort('created_at', 'desc');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Setting extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'key',
|
||||
'value',
|
||||
'type',
|
||||
'group',
|
||||
'label',
|
||||
'description',
|
||||
'is_public',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_public' => 'boolean',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get setting by key
|
||||
*/
|
||||
public static function get(string $key, $default = null)
|
||||
{
|
||||
$setting = static::where('key', $key)
|
||||
->where('is_active', true)
|
||||
->first();
|
||||
|
||||
if (!$setting) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
return static::castValue($setting->value, $setting->type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set setting value
|
||||
*/
|
||||
public static function set(string $key, $value, string $type = 'string'): void
|
||||
{
|
||||
static::updateOrCreate(
|
||||
['key' => $key],
|
||||
[
|
||||
'value' => $value,
|
||||
'type' => $type,
|
||||
'is_active' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast value based on type
|
||||
*/
|
||||
protected static function castValue($value, string $type)
|
||||
{
|
||||
return match($type) {
|
||||
'boolean' => filter_var($value, FILTER_VALIDATE_BOOLEAN),
|
||||
'integer' => (int) $value,
|
||||
'float' => (float) $value,
|
||||
'array', 'json' => json_decode($value, true),
|
||||
default => $value,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all settings by group
|
||||
*/
|
||||
public static function getGroup(string $group): array
|
||||
{
|
||||
return static::where('group', $group)
|
||||
->where('is_active', true)
|
||||
->pluck('value', 'key')
|
||||
->map(function ($value, $key) use ($group) {
|
||||
$setting = static::where('key', $key)->first();
|
||||
return static::castValue($value, $setting->type);
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Setting>
|
||||
*/
|
||||
class SettingFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SettingSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$settings = [
|
||||
// Genel Ayarlar
|
||||
[
|
||||
'key' => 'site_name',
|
||||
'value' => 'Citrus Platform',
|
||||
'type' => 'string',
|
||||
'group' => 'general',
|
||||
'label' => 'Site Adı',
|
||||
'description' => 'Web sitesinin adı',
|
||||
'is_public' => true,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'site_description',
|
||||
'value' => 'Modern ve güvenilir web platformu',
|
||||
'type' => 'text',
|
||||
'group' => 'general',
|
||||
'label' => 'Site Açıklaması',
|
||||
'description' => 'Web sitesinin açıklaması',
|
||||
'is_public' => true,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'site_keywords',
|
||||
'value' => 'citrus, platform, web, modern',
|
||||
'type' => 'string',
|
||||
'group' => 'general',
|
||||
'label' => 'Site Anahtar Kelimeleri',
|
||||
'description' => 'SEO için anahtar kelimeler',
|
||||
'is_public' => true,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'maintenance_mode',
|
||||
'value' => '0',
|
||||
'type' => 'boolean',
|
||||
'group' => 'general',
|
||||
'label' => 'Bakım Modu',
|
||||
'description' => 'Site bakım modunda mı?',
|
||||
'is_public' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
|
||||
// E-posta Ayarları
|
||||
[
|
||||
'key' => 'mail_from_address',
|
||||
'value' => 'noreply@citrus.truncgil.com',
|
||||
'type' => 'string',
|
||||
'group' => 'email',
|
||||
'label' => 'E-posta Gönderen Adres',
|
||||
'description' => 'Sistem e-postalarının gönderileceği adres',
|
||||
'is_public' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'mail_from_name',
|
||||
'value' => 'Citrus Platform',
|
||||
'type' => 'string',
|
||||
'group' => 'email',
|
||||
'label' => 'E-posta Gönderen İsim',
|
||||
'description' => 'Sistem e-postalarının gönderen adı',
|
||||
'is_public' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'mail_notifications_enabled',
|
||||
'value' => '1',
|
||||
'type' => 'boolean',
|
||||
'group' => 'email',
|
||||
'label' => 'E-posta Bildirimleri Aktif',
|
||||
'description' => 'E-posta bildirimleri gönderilsin mi?',
|
||||
'is_public' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
|
||||
// SEO Ayarları
|
||||
[
|
||||
'key' => 'seo_meta_title',
|
||||
'value' => 'Citrus Platform - Modern Web Platformu',
|
||||
'type' => 'string',
|
||||
'group' => 'seo',
|
||||
'label' => 'SEO Meta Başlık',
|
||||
'description' => 'Varsayılan SEO meta başlığı',
|
||||
'is_public' => true,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'seo_meta_description',
|
||||
'value' => 'Modern ve güvenilir web platformu',
|
||||
'type' => 'text',
|
||||
'group' => 'seo',
|
||||
'label' => 'SEO Meta Açıklama',
|
||||
'description' => 'Varsayılan SEO meta açıklaması',
|
||||
'is_public' => true,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'seo_google_analytics',
|
||||
'value' => '',
|
||||
'type' => 'string',
|
||||
'group' => 'seo',
|
||||
'label' => 'Google Analytics ID',
|
||||
'description' => 'Google Analytics takip kodu',
|
||||
'is_public' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
|
||||
// Sosyal Medya Ayarları
|
||||
[
|
||||
'key' => 'social_facebook',
|
||||
'value' => '',
|
||||
'type' => 'string',
|
||||
'group' => 'social',
|
||||
'label' => 'Facebook URL',
|
||||
'description' => 'Facebook sayfa URL\'si',
|
||||
'is_public' => true,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'social_twitter',
|
||||
'value' => '',
|
||||
'type' => 'string',
|
||||
'group' => 'social',
|
||||
'label' => 'Twitter URL',
|
||||
'description' => 'Twitter profil URL\'si',
|
||||
'is_public' => true,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'social_instagram',
|
||||
'value' => '',
|
||||
'type' => 'string',
|
||||
'group' => 'social',
|
||||
'label' => 'Instagram URL',
|
||||
'description' => 'Instagram profil URL\'si',
|
||||
'is_public' => true,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'social_linkedin',
|
||||
'value' => '',
|
||||
'type' => 'string',
|
||||
'group' => 'social',
|
||||
'label' => 'LinkedIn URL',
|
||||
'description' => 'LinkedIn profil URL\'si',
|
||||
'is_public' => true,
|
||||
'is_active' => true,
|
||||
],
|
||||
|
||||
// Güvenlik Ayarları
|
||||
[
|
||||
'key' => 'security_max_login_attempts',
|
||||
'value' => '5',
|
||||
'type' => 'integer',
|
||||
'group' => 'security',
|
||||
'label' => 'Maksimum Giriş Denemesi',
|
||||
'description' => 'Kullanıcı hesabının kilitlenmesi için maksimum giriş denemesi',
|
||||
'is_public' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'security_session_timeout',
|
||||
'value' => '120',
|
||||
'type' => 'integer',
|
||||
'group' => 'security',
|
||||
'label' => 'Oturum Zaman Aşımı (dakika)',
|
||||
'description' => 'Kullanıcı oturumunun zaman aşımına uğrayacağı süre',
|
||||
'is_public' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'security_2fa_enabled',
|
||||
'value' => '0',
|
||||
'type' => 'boolean',
|
||||
'group' => 'security',
|
||||
'label' => 'İki Faktörlü Doğrulama',
|
||||
'description' => 'İki faktörlü doğrulama aktif mi?',
|
||||
'is_public' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
|
||||
// Bildirim Ayarları
|
||||
[
|
||||
'key' => 'notification_email_enabled',
|
||||
'value' => '1',
|
||||
'type' => 'boolean',
|
||||
'group' => 'notification',
|
||||
'label' => 'E-posta Bildirimleri',
|
||||
'description' => 'E-posta bildirimleri gönderilsin mi?',
|
||||
'is_public' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'notification_sms_enabled',
|
||||
'value' => '0',
|
||||
'type' => 'boolean',
|
||||
'group' => 'notification',
|
||||
'label' => 'SMS Bildirimleri',
|
||||
'description' => 'SMS bildirimleri gönderilsin mi?',
|
||||
'is_public' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'notification_push_enabled',
|
||||
'value' => '0',
|
||||
'type' => 'boolean',
|
||||
'group' => 'notification',
|
||||
'label' => 'Push Bildirimleri',
|
||||
'description' => 'Push bildirimleri gönderilsin mi?',
|
||||
'is_public' => false,
|
||||
'is_active' => true,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($settings as $setting) {
|
||||
Setting::updateOrCreate(
|
||||
['key' => $setting['key']],
|
||||
$setting
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user