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\OtherInvestmentSection; class OtherInvestmentSectionController extends Controller { public function __construct() { $this->middleware('auth:admin'); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $data['otherInvestmentSection'] = OtherInvestmentSection::first(); return view('admin.homepageManager.otherInvestmentSection.list', $data); } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(OtherInvestmentSection $otherInvestmentSection) { $data['otherInvestmentSection'] = $otherInvestmentSection; return view('admin.homepageManager.otherInvestmentSection.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, OtherInvestmentSection $otherInvestmentSection) { $changed = false; $values = $request->validate([ "left_image"=>'nullable|image|max:2000', "content"=>'required|string|max:5000', ]); if ($request->left_image) { Storage::delete($otherInvestmentSection->left_image); $values['left_image'] = Storage::putFile('public/homeImages', new File($request->left_image)); } $otherInvestmentSection->fill($request->except('left_image')); if (isset($values['left_image'])) { $otherInvestmentSection->left_image = $values['left_image']; } if ($otherInvestmentSection->isDirty()) { $otherInvestmentSection->save(); $changed = true; } if (! $changed) { $notify[] = ['warning', 'No changes done to save']; return redirect()->route('otherInvestmentSection.index')->withNotify($notify); } $notify[] = ['success', 'Other Investment Section is Updated!']; return redirect()->route('otherInvestmentSection.index')->withNotify($notify); } }
[+]
..
[-] InvestmentSectionController.php
[edit]
[-] UnmatchSectionController.php
[edit]
[-] LinkSectionController.php
[edit]
[-] OtherInvestmentSectionController.php
[edit]
[-] GoldstarSectionController.php
[edit]