/** * This function loads all the Services for a selected Event Type to the view. * * @param string POST data AJAX request * * @return all the Services of a selected Event Type as $result variable */ public function LoadServices() { $event = Request::all(); $event = $event['event']; $result = Event_Services::select('Service')->where('EventName', $event)->get(); return $result; }
<img src="{{asset('images/event-icons').'/'.$imgurl}}" onError="this.onerror=null;this.src='{{asset('images/event-icons/na.png')}}';" height="50" width="50"> </div> <div class="pricing-title"> {{$y_value}} </div> <div style="height: 86px;" class="pricing-features"> <ul class="sf-list pr-list"> <?php //choose the corresponding services in the event type $ServicesQuery = Event_Services::select('*')->where('EventName', $y_value)->get(); if ($ServicesQuery != null) { foreach ($ServicesQuery as $service) { $serv = $service->Service; $description = Services::select('*')->where('Service', $serv)->get(); //$desc = $description->Description; //echo '<li>'; foreach ($description as $d) { $desc = $d->Description; } echo "<li style='padding:2px 20px' title='" . $desc . "' >" . $service->Service . "</li>"; //echo '</li>'; } } ?> </ul>
/** * This function takes care of the post method in edit event category page. * * @param string POST Data * * @return if db error -> event category page with error message | no errors -> event categories page with success message */ public function EditEventCategoriesPost() { $input = Request::all(); $iTasks = array(); //if delete button is clicked, delete data from db if (isset($_POST['deltype'])) { $deliName = $input['evnamedel']; Event_Types::where('EventName', $deliName)->delete(); Event_Services::where('EventName', $deliName)->delete(); return redirect('dashboard/events/categories')->with('message', 'Record Deleted Successfully'); } else { //get event name to variable $iName = $input['evname']; try { //delete exsisting event service data Event_Services::where('EventName', $iName)->delete(); foreach ($input['eservices'] as $x) { //insert new event service data $iTasks[] = $x; Event_Services::insert([['EventName' => $iName, 'Service' => $x]]); } //check if image upload has no errors if ($_FILES["img"]["error"] == 0) { $iIcon = $input['img']; $fileext = Request::file('img')->getClientOriginalExtension(); //if image is not png format. return with error message. if ($fileext != 'png') { return redirect('events/categories')->with('message', 'Record Update Failed'); } //modify image name $filename = Request::file('img')->getClientOriginalName(); $iName = $input['evname']; $filefull = $iName . '.' . $fileext; $filefull = str_replace(' ', '_', $filefull); //upload the image to the path Request::file('img')->move(base_path() . '/public/images/event-icons', $filefull); Event_Types::where('EventName', $iName)->update(['Icon' => $filefull]); } return redirect('dashboard/events/categories/')->with('message', 'Record Updated Successfully'); } catch (\Illuminate\Database\QueryException $e) { return redirect('dashboard/events/categories/')->with('message', 'Record Update Failed ' . $e->getCode()); } } }
.is_available{ color:green; } .is_not_available{ color:red; } </style> <?php use App\Models\Event_Types; use App\Models\Event_Services; use App\Models\Services; //get data from tables using EventName from URL $services = Services::distinct()->select('Service')->groupBy('Service')->get(); $result4 = Event_Services::select('Service')->where('EventName', $EventName)->get(); $result3 = Event_Types::select('*')->where('EventName', $EventName)->get(); foreach ($result3 as $ic) { $result3 = $ic->Icon; } ?> @endsection @section('header-js') @endsection @section('content') <div class="content"> <div class="container">