public function compose(View $view) { $path = $this->request->path(); $currentLanguage = LaravelLocalization::getCurrentLocale(); if (starts_with($path, $currentLanguage . '/')) { $path = str_replace($currentLanguage . '/', '', $path); } elseif ($path == $currentLanguage) { $path = str_replace($currentLanguage, '', $path); } $main_banners = MainBanner::inURL($path)->orderBy('sort_order', 'ASC')->get(); $view->with(['main_banners' => $main_banners]); }
public function delete(Request $request, $id) { $main_banner = MainBanner::findOrFail($id); $main_banner->delete(); return redirect()->route('admin.main_banner.index')->with('messages', ['Main Banner is successfully deleted.']); }