EVOLUTION-NINJA
Edit File: exhibition.php
<?php namespace App\Controllers\admin; use App\Controllers\BaseController; use CodeIgniter\RESTful\ResourceController; use CodeIgniter\API\ResponseTrait; // use App\Models\RegisterUserModel; // use App\Models\OrganisationModel; // use App\Models\conference_AttendUserModel; // use App\Models\Conf_About; use App\Models\exhibitionModel; use App\Models\NotificationModel; class exhibition extends BaseController{ use ResponseTrait; public function __construct() { helper(['form']); // helper(['url']); } public function index(){ $dr_id = session()->get('dr_id'); // if(){ // }else{ // } return view('admin/add-industry'); } public function add_exhibithion(){ // print_r('hi');die(); $org_id = session()->get('org_id'); $dr_id = session()->get('dr_id'); $company_name = $this->request->getVar('company_name'); $about_company = $this->request->getVar('about_company'); $website = $this->request->getVar('website'); $mail = $this->request->getVar('mail'); $contact_person = $this->request->getVar('contact_person'); $phone_no = $this->request->getVar('phone_no'); $products = $this->request->getVar('products'); $logo = $this->request->getFile('logo'); if($logo->isValid() && !$logo->hasMoved()){ $newName = $logo->getName(); // $profile_pic_fac = $logo->getName(); $logo->move('public/uploads/exhibition/', $newName); } $add_exhibitions = array( 'org_id'=>$org_id, 'dr_id'=>$dr_id, 'logo'=>$logo->getClientName(), 'company_name'=>$company_name, 'about_company'=>$about_company, 'website'=>$website, 'mail'=>$mail, 'contact_person'=>$contact_person, 'phone'=>$phone_no, 'products'=>$products, // 'created_by'=> ); // print_r($add_exhibitions);die(); $model = new exhibitionModel(); $model->save($add_exhibitions); $insertedID = $model->insertID(); $title = "New content is uploaded to Industry Exhibitions"; $message = $company_name." company is added Industry Exhibitions"; $date = date("Y-m-d"); date_default_timezone_set("Asia/Calcutta"); //India time (GMT+5:30) $time = date('H:i:s'); $details = array( //'user_id'=>$user_id, 'type'=>$title, 'message'=>$message, 'sending_to'=>"All", 'status'=>'active', 'created_at'=>$date, 'time'=> $time , 'links_main'=>'https://medusys.in/add-industry' ); $add_note = new NotificationModel(); $add_note->save($details); $insertedID = $add_note->insertID(); if($insertedID){ return json_encode(array( 'result' => 1, 'message' => 'inserted successfully ' )); } else{ return json_encode(array( 'result' => 0, 'message' => 'Something went wrong.....' )); } } } ?>