Changes
This commit is contained in:
@@ -60,7 +60,7 @@ class PageController extends Controller
|
||||
abort($error);
|
||||
}
|
||||
|
||||
return Inertia::render($page->template, compact('page', 'subSectionPages', 'breadcrumbs', 'seo'));
|
||||
return Inertia::render('Page', compact('page', 'subSectionPages', 'breadcrumbs', 'seo'));
|
||||
}
|
||||
public function getRegisteredPages()
|
||||
{
|
||||
@@ -78,74 +78,4 @@ class PageController extends Controller
|
||||
];
|
||||
return Inertia::render('AdminPanel/Pages/Registered', compact('pages', 'filters'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
$pages = PageResource::collection(Page::query()
|
||||
->when(request()->input('search'), function ($query, $search) {
|
||||
$query->where('title', 'like', "%{$search}%");
|
||||
})
|
||||
->where('is_registered', false)
|
||||
->orderBy('id', 'desc')
|
||||
->paginate(request()->input('perPage', 9))
|
||||
->withQueryString());
|
||||
$filters = [
|
||||
'search' => request()->input('search'),
|
||||
];
|
||||
return Inertia::render('AdminPanel/Pages/Index', compact('pages', 'filters'));
|
||||
}
|
||||
|
||||
public function edit($slug)
|
||||
{
|
||||
$page = new PageResource(Page::where('slug', '=', $slug)->first());
|
||||
return Inertia::render('AdminPanel/Pages/Edit', compact('page'));
|
||||
}
|
||||
|
||||
public function update(Page $page, UpdateRequest $request)
|
||||
{
|
||||
$data = $request->validated();
|
||||
$data['content'] = json_encode($data['content']);
|
||||
$page->update($data);
|
||||
return redirect()->route('admin.page.index');
|
||||
}
|
||||
|
||||
public function editRegisteredPage($id)
|
||||
{
|
||||
$page = new RegisteredPageResource(Page::find($id));
|
||||
return Inertia::render('AdminPanel/Pages/EditRegisteredPage', compact('page'));
|
||||
}
|
||||
|
||||
public function updateRegisteredPage($id, Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'title' => 'required',
|
||||
'path' => 'required',
|
||||
'is_visible' => 'required',
|
||||
'code' => 'required'
|
||||
]);
|
||||
$page = Page::find($id);
|
||||
$page->update($data);
|
||||
return redirect()->route('admin.registered.page.index');
|
||||
}
|
||||
|
||||
public function destroy(Page $page)
|
||||
{
|
||||
$page->delete();
|
||||
return redirect()->route('admin.page.index');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return Inertia::render('AdminPanel/Pages/Create');
|
||||
}
|
||||
|
||||
public function store(StoreRequest $request)
|
||||
{
|
||||
$data = $request->validated();
|
||||
$data['content'] = json_encode($data['content']);
|
||||
Page::create($data);
|
||||
return redirect()->route('admin.page.index');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ class ClientPageNavigateResource extends JsonResource
|
||||
'slug' => $this->slug,
|
||||
'path' => $this->path,
|
||||
'is_url' => $this->is_url,
|
||||
'icon' => $this->icon
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ class PageResource extends JsonResource
|
||||
'code' => $this->code,
|
||||
'path' => $this->path,
|
||||
'is_url' => $this->is_url,
|
||||
'settings' => $this->settings,
|
||||
'icon' => $this->icon,
|
||||
'section' => $this->section ? $this->section->title : null,
|
||||
'created_at' => $this->created_at->diffforhumans()
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user