PATH:
home
/
lab2454c
/
tripvare.com
/
app
/
Http
/
Controllers
/
admin
/
dashboard
<?php namespace App\Http\Controllers\admin\dashboard; use App\Http\Controllers\Controller; use App\Models\StaticPage; use Illuminate\Http\Request; class ManagePages extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function listPages() { $pages = StaticPage::orderBy('title')->paginate(env('LIST_PER_PAGE')); return view('admin/dashboard/manage_pages/list')->with('pages', $pages); } public function removePageGalleryInfo(Request $request, $id){ $page = StaticPage::find($id); $filename = $request->get('filename'); if ($request->isMethod('post') && $page->other_meta_data != '') { $other_meta_data = unserialize($page->other_meta_data); foreach($other_meta_data as $key => $img){ if($img['original_filename'] == $filename){ unset($other_meta_data[$key]); break; } } $page->other_meta_data = serialize($other_meta_data); $page->save(); return response()->json(['success'=>$filename]); } } public function pageGalleryInfo(Request $request, $id, $p) { $data = []; $request->validate( [ 'file' => 'mimes:jpg,jpeg,png,gif|max:5096', ] ); $page = StaticPage::find($id); if ($request->isMethod('post') && $request->hasFile('file') && $request->file->isValid()) { $data = []; $image = $request->file('file'); $fileInfo = $image->getClientOriginalName(); $file = cloudinary()->upload($request->file('file')->getRealPath(), [ 'folder' => 'uploads', 'transformation' => [ 'quality' => 'auto', 'fetch_format' => 'auto' ] ])->getSecurePath(); if ($page->other_meta_data != '') { $data = unserialize($page->other_meta_data); } array_push($data,[ "original_filename" => $fileInfo, "filename" => $file, ]); $page->other_meta_data = serialize($data); $page->save(); return response()->json(['success' => $fileInfo]); } $other_meta_data = $page->other_meta_data != '' ? unserialize($page->other_meta_data) : ''; if (is_array($other_meta_data)) { foreach ($other_meta_data as $img) { $obj['name'] = $img['original_filename']; $obj['size'] = get_headers($img['filename'], true)['Content-Length']; $obj['path'] = $img['filename']; $data[] = $obj; } } return response()->json($data); } /** * Show the form for editing the specified resource. * * @param \App\Models\Page $page * @return \Illuminate\Http\Response */ public function pageInfo(Request $request, $id, $p) { $page = StaticPage::find($id); if ($request->isMethod('post')) { $data = []; $request->validate( [ 'title' => 'required', 'content_block_image' => 'mimes:jpg,jpeg,png|max:4096', ] ); if ($request->hasFile('content_block_image') && $request->content_block_image->isValid()) { $content_block_image = cloudinary()->upload($request->file('content_block_image')->getRealPath(), [ 'folder' => 'uploads', 'transformation' => [ 'quality' => 'auto', 'fetch_format' => 'auto' ] ])->getSecurePath(); } $page->title = $request->title; for ($i = 2; $i <= 6; $i++) { $data["content_block_{$i}"] = $request->{"content_block_{$i}"}; } $meta_data = unserialize($page->meta_data); if(isset($content_block_image)){ $data["content_block_image"] = isset($content_block_image) ? $content_block_image : ''; }else if(isset($meta_data['content_block_image'] )){ $data["content_block_image"] = $meta_data['content_block_image']; } $page->meta_data = serialize($data); $page->meta_key = $request->meta_key; $page->meta_description = $request->meta_description; $page->save(); return back()->with('success', __('messages.admin.manage_pages.update_success')); } if (is_null($page)) { return redirect()->route('admin.list-pages'); } $meta_data = unserialize($page->meta_data); return view('admin/dashboard/manage_pages/page_info')->with('page_info', $page)->with('meta_data', $meta_data)->with('page', $p); } }
[-] AdminProfile.php
[edit]
[-] ManageCorporateUser.php
[edit]
[+]
..
[-] ManageNavigation.php
[edit]
[-] AdminDashboard.php
[edit]
[-] ManageUser.php
[edit]
[-] ManageSettings.php
[edit]
[-] ManagePages.php
[edit]
[-] ManageReward.php
[edit]