PATH:
home
/
lab2454c
/
aficb.com
/
app
/
Http
/
Controllers
/
Admin
<?php namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use App\Models\Testimonial; class TestimonialController extends Controller { public function __construct() { $this->middleware('auth:admin'); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $data['testimonials'] = Testimonial::orderBy('created_at', 'DESC')->paginate(8); return view('admin.homepageManager.testimonial.list', $data); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { return view('admin.homepageManager.testimonial.create'); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $values = $request->validate([ "given_by" => "required|string|max:200", "position" => "nullable|string|max:100", "testimonial" => "required|string|max:500", ]); $testimonial = new Testimonial(); $testimonial->fill($values); $testimonial->save(); toast("Testimonial is added Successfully!", "success"); return redirect()->route('testimonial.index'); } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Testimonial $testimonial) { $data['testimonial'] = $testimonial; return view('admin.homepageManager.testimonial.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, Testimonial $testimonial) { $changed = false; $values = $request->validate([ "given_by" => "required|string|max:200", "position" => "nullable|string|max:100", "testimonial" => "required|string|max:500", ]); $testimonial->fill($values); if ($testimonial->isDirty()) { $testimonial->save(); $changed = true; } if (! $changed) { toast('No changes done to save', 'warning'); return redirect()->route('testimonial.index')->withErrors('No changes done to save'); } toast('Testimonial is updated Successfully!','success'); return redirect()->route('testimonial.index'); } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy(Testimonial $testimonial) { if ($testimonial->status == 'active') { $testimonial->status = 'inactive'; } else { $testimonial->status = 'active'; } $testimonial->save(); toast('Testimonial is ' . (($testimonial->status == 'inactive') ? 'disabled' : 'enabled') . ' Successfully!','success'); return redirect()->route('testimonial.index'); } }
[-] HomeBannerController.php
[edit]
[-] EventController.php
[edit]
[-] CategoryController.php
[edit]
[-] PasswordController.php
[edit]
[-] CareerController.php
[edit]
[-] CareerContentController.php
[edit]
[+]
..
[-] EventContentController.php
[edit]
[-] SiteSettingController.php
[edit]
[-] ServiceController.php
[edit]
[-] PageController.php
[edit]
[-] TestimonialController.php
[edit]
[-] HomeTitleController.php
[edit]
[-] SocialLinkController.php
[edit]
[-] FeaturedProductController.php
[edit]
[-] ExploreController.php
[edit]
[-] MinerPageController.php
[edit]
[-] AdminUserController.php
[edit]
[-] LeadershipController.php
[edit]
[-] FaqController.php
[edit]
[-] CommodityTraderPageController.php
[edit]
[-] GalleryController.php
[edit]
[-] LoginController.php
[edit]
[-] MinerContentController.php
[edit]
[-] TraderBannerLinkController.php
[edit]
[-] DashboardController.php
[edit]
[-] MinerBannerLinkController.php
[edit]
[-] CommodityTraderContentController.php
[edit]