public function ajaxRequest($id = 1, $modal_name = null) { // dd($modal_name); if ($modal_name == 'modal-service') { // get all the service_details $service_detail = Service_detail::find($id); $service_detail->image = "<img class=\"radius2px img-responsive\" src=\"public/{$service_detail->image}\">"; return $service_detail; } else { // get all the Projects $project = Project::orderBy('position')->select('detail_title', 'text')->find($id); // get all the Project_image $project_images = Project_image::where('project_id', '=', $id)->orderBy('position')->get(['image']); $images = ''; $pagers = ''; foreach ($project_images as $key => $project_images_item) { $images .= <<<IMG <li><img src="public/{$project_images_item->image}"/></li> IMG; $pagers .= <<<PG <a data-slide-index="{$key}" href=""><img src="public/{$project_images_item->image}"/></a> PG; } // $pagers .= '</div>'; return compact('project', 'images', 'pagers'); // return ['detail_title' => 'title', 'text' => '{{$test}}', 'image' => '<img class="radius2px img-responsive" src="http://www.concept7.com.tr/uploades/service_detail/34158-image().jpg">']; } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $service_detail = Service_detail::find($id); // get the service $service = Service::find($service_detail->service_id); // delete $service_detail->delete(); // redirect \Session::flash('message', 'Successfully deleted the service_detail!'); return \Redirect::to("admin/service_details/{$service->id}"); }