public function index() { $projects = Project::latest()->where('published', 1)->get(); $illustrations = Illustration::latest()->get(); $logos = Logo::latest()->get(); return view('front', compact('projects', 'illustrations', 'logos')); }
public function showDashboard() { $projects = new Project(); $projectCount = $projects->count(); $published = $projects->where('published', 1)->count(); $unpublished = $projects->where('published', 0)->count(); $illustrations = Illustration::count(); $logos = Logo::count(); return view('dashboard/dashboard', compact('projectCount', 'published', 'unpublished', 'illustrations', 'logos')); }
public function removeIllustration(Request $request) { if ($request->imageName) { $illustration = Illustration::where('thumb', $request->imageName)->firstOrFail(); $illustrationPath = 'build/images/illustrations/'; $imageNameOrigin = $illustration->image; $imageNameThumb = $illustration->thumb; Storage::disk('public')->delete($illustrationPath . $imageNameThumb); Storage::disk('public')->delete($illustrationPath . $imageNameOrigin); $illustration->delete(); return 'ok'; } else { return 'failed'; } }