page = Page::query()->where('slug', $slug)->firstOrFail(); $this->content_ar = $this->page->content_ar ?? ''; $this->content_en = $this->page->content_en ?? ''; } public function setTab(string $tab): void { $this->activeTab = $tab; } public function save(): void { $oldValues = $this->page->toArray(); $this->page->update([ 'content_ar' => clean($this->content_ar), 'content_en' => clean($this->content_en), ]); AdminLog::create([ 'admin_id' => auth()->id(), 'action' => 'update', 'target_type' => 'page', 'target_id' => $this->page->id, 'old_values' => $oldValues, 'new_values' => $this->page->fresh()->toArray(), 'ip_address' => request()->ip(), 'created_at' => now(), ]); session()->flash('success', __('pages.page_saved')); } public function togglePreview(): void { $this->showPreview = ! $this->showPreview; } public function closePreview(): void { $this->showPreview = false; } }; ?>
{{ __('pages.last_updated') }}: {{ $page->updated_at->diffForHumans() }}