PATH:
home
/
lab2454c
/
westernclear.net
/
app
/
Http
/
Controllers
/
Admin
/
Home
<?php namespace App\Http\Controllers\Admin\Home; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; use Illuminate\Http\File; use App\Models\GoldstarSection; class GoldstarSectionController extends Controller { public function __construct() { $this->middleware('auth:admin'); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $data['goldstarSection'] = GoldstarSection::first(); return view('admin.homepageManager.goldstarSection.list', $data); } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(GoldstarSection $goldstarSection) { $data['goldstarSection'] = $goldstarSection; return view('admin.homepageManager.goldstarSection.edit', $data); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, GoldstarSection $goldstarSection) { $changed = false; $values = $request->validate([ "left_image"=>'nullable|image|max:2000', "content"=>'required|string|max:5000', ]); if ($request->left_image) { Storage::delete($goldstarSection->left_image); $values['left_image'] = Storage::putFile('public/homeImages', new File($request->left_image)); } $goldstarSection->fill($request->except('left_image')); if (isset($values['left_image'])) { $goldstarSection->left_image = $values['left_image']; } if ($goldstarSection->isDirty()) { $goldstarSection->save(); $changed = true; } if (! $changed) { $notify[] = ['warning', 'No changes done to save']; return redirect()->route('goldstarSection.index')->withNotify($notify); } $notify[] = ['success', 'Section is Updated!']; return redirect()->route('goldstarSection.index')->withNotify($notify); } }
[+]
..
[-] InvestmentSectionController.php
[edit]
[-] UnmatchSectionController.php
[edit]
[-] LinkSectionController.php
[edit]
[-] OtherInvestmentSectionController.php
[edit]
[-] GoldstarSectionController.php
[edit]