new design with nice layout
This commit is contained in:
@@ -1,15 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Admin;
|
||||
|
||||
use App\Models\SiteSetting;
|
||||
use Livewire\Component;
|
||||
class Settings extends Component {
|
||||
public string $site_name=''; public string $email=''; public string $footer_tagline=''; public string $location='';
|
||||
public function mount(): void { foreach (['site_name','email','footer_tagline','location'] as $key) $this->$key=SiteSetting::where('key',$key)->value('value') ?? ''; }
|
||||
public function save(): void {
|
||||
$data=$this->validate(['site_name'=>'required|string|max:100','email'=>'required|email|max:255',
|
||||
'footer_tagline'=>'nullable|string|max:255','location'=>'nullable|string|max:255']);
|
||||
foreach ($data as $key=>$value) SiteSetting::updateOrCreate(['key'=>$key],['value'=>$value]);
|
||||
session()->flash('status','Settings updated.');
|
||||
|
||||
class Settings extends Component
|
||||
{
|
||||
public string $site_name = '';
|
||||
|
||||
public string $email = '';
|
||||
|
||||
public string $footer_tagline = '';
|
||||
|
||||
public string $location = '';
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
foreach (['site_name', 'email', 'footer_tagline', 'location'] as $key) {
|
||||
$this->$key = SiteSetting::where('key', $key)->value('value') ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
public function save(): void
|
||||
{
|
||||
$data = $this->validate(['site_name' => 'required|string|max:100', 'email' => 'required|email|max:255',
|
||||
'footer_tagline' => 'nullable|string|max:255', 'location' => 'nullable|string|max:255']);
|
||||
foreach ($data as $key => $value) {
|
||||
SiteSetting::updateOrCreate(['key' => $key], ['value' => $value]);
|
||||
}
|
||||
session()->flash('status', 'Settings updated.');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.admin.settings')->layout('layouts.admin', ['title' => 'Site settings']);
|
||||
}
|
||||
public function render() { return view('livewire.admin.settings')->layout('layouts.admin',['title'=>'Site settings']); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user