home
/
zktecojo
/
public_html
/
app
/
controllers
/
admin
➕ New
📤 Upload
✎ Editing:
pdfDownloadController.php
← Back
<?php class PdfDownloadController extends BaseController { public function __construct(){ $this->is_admin_login(); parent::__construct(); } public function index(){ $this->data['pdfList']= DB::table('pdf_download') ->orderBy('pdf_priority','asc') ->get(); // dd($this->data['articlesList']); return View::make('admin.pdfDownload.list',$this->data); } public function create(){ $this->data['messages']=''; if(Input::get('createbtnsubmit')){ // $this->data = Input::get(); // echo "DD";exit(); // $filename = $this->resize_and_crop_image('articles_image_name','assets/uploads/articles',array(array('width'=>555,'height'=>303,'folder'=>'large'),array('width'=>263,'height'=>301,'folder'=>'small')),null); $insertDatas = array( 'name' =>Input::get('pdf_title'), 'pdf_priority' =>Input::get('pdf_priority'), 'status' =>Input::get('pdf_status'), ); $file = Input::file('pdf_label'); if(!empty($file)){ if($file->getClientMimeType() == 'application/pdf' || $file->getClientMimeType() == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') { $destinationPath = 'assets/uploads/pdf/file'; if (!empty($file)){ $filename = $file->getClientOriginalName(); if(!empty($filename)){ $upload_success = $file->move($destinationPath, $filename); } $insertDatas['pdf_name'] = $filename; } } } DB::table('pdf_download')->insert($insertDatas); $this->data['messages'] =$this->custom_message('Pdf Added Successfully','success'); } // $this->data['articlesMenuList'] = DB::table('menus')->where('menu_status','=',1)->get(); return View::make('admin.pdfDownload.add',$this->data); } public function edit($editID){ if(empty($editID)) { return Redirect::to('admin/articles');} $this->data['messages'] =''; if(Input::get('updatebtnsubmit')){ $datasupdate = array( 'name' =>Input::get('pdf_title'), 'pdf_priority' =>Input::get('pdf_priority'), 'status' =>Input::get('pdf_status'), ); $file = Input::file('articles_image_name'); if(!empty($file)){ if($file->getClientMimeType() == 'application/pdf' || $file->getClientMimeType() == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') { $destinationPath = 'assets/uploads/pdf/file'; if (!empty($file)){ $filename = $file->getClientOriginalName(); if(!empty($filename)){ $upload_success = $file->move($destinationPath, $filename); } $insertDatas['pdf_name'] = $filename; } } } DB::table('pdf_download')->where('id', '=',$editID)->update($datasupdate); $this->data['messages'] = $this->custom_message('Pdf updated successfully','success'); } $this->data['rsarticles'] = DB::table('pdf_download')->where('id','=',$editID)->first(); return View::make('admin.pdfDownload.edit',$this->data); } public function changestatus($statusID,$currentStatus){ $currentStatus = ($currentStatus==0)?1:0; $currentStatusdatas = array("status"=>$currentStatus); DB::table('pdf_download')->where('id', '=',$statusID)->update($currentStatusdatas); return Redirect::to('admin/pdfDownload')->with('flash_error','deleted'); } public function delete($deleteID){ if(empty($deleteID)) { return Redirect::to('admin/pdfDownload');} $articlesList = DB::table('pdf_download')->where('id','=',$deleteID)->get(); /* foreach($articlesList as $articles){ if(File::exists('assets/uploads/articles/'.$articles->articles_image_name)){ File::delete('assets/uploads/articles/'.$articles->articles_image_name); File::delete('assets/uploads/articles/small/'.$articles->articles_image_name); File::delete('assets/uploads/articles/large/'.$articles->articles_image_name); } } */ DB::table('pdf_download')->where('id', '=',$deleteID)->delete(); $this->data['messages'] = $this->custom_message('Deleted Successfully','success'); return Redirect::to('admin/pdfDownload')->with('flash_error','deleted'); } }
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel