public function packages()
 {
     $this->data['cycles'] = Cycle::all();
     $this->data['services'] = Service::orderBy('name')->get();
     $this->data['packages'] = Package::paginate(25);
     return $this->layout->content = View::make('packages', $this->data);
 }
Exemple #2
0
 public function getAllServices()
 {
     // services
     $all_services = Service::orderBy('name', 'ASC')->get(['id', 'name']);
     $services = [];
     foreach ($all_services as $service) {
         $services[] = (object) ['value' => $service->id, 'label' => utf8_encode($service->name)];
     }
     return $services;
 }
 public function initialLoad()
 {
     $advertisings = Advertising::orderBy('order', 'asc')->get();
     $budgets = Budget::orderBy('order', 'asc')->get();
     $doctors = Doctor::with('speciality')->get();
     $nav_menus = NavigationMenu::orderBy('order', 'asc')->get();
     $promos = Promo::all();
     $services = Service::orderBy('order', 'asc')->get();
     $slider_images = SliderImage::all();
     $specialities = Speciality::all();
     return View::make('layouts.main', array('advertisings' => $advertisings, 'budgets' => $budgets, 'doctors' => $doctors, 'nav_menus' => $nav_menus, 'promos' => $promos, 'services' => $services, 'slider_images' => $slider_images, 'specialities' => $specialities));
 }
 public function getArea()
 {
     $roles = Role::all();
     $services = Service::orderBy('action')->get();
     $services = $services->toArray();
     $groupedServices = [];
     foreach ($services as $service) {
         $actions = preg_split('/@/', $service['action']);
         if (count($actions) >= 2) {
             $groupedServices[$actions[0]][] = ['id' => $service['id'], 'libelle' => $actions[1]];
         }
     }
     $result = [];
     foreach ($roles as $role) {
         $result[] = ['libelle' => $role->libelle, 'id' => $role->id, 'choices' => $groupedServices];
     }
     return $result;
 }
 /**
  * [getData - datatables response]
  * @return [json] [DT compatible object]
  */
 public function getData()
 {
     $Model = $this->modelName;
     $num_skip = 0;
     $num_items = 10;
     $recordsTotal = 0;
     $recordsFiltered = 0;
     // check get vars
     if (isset($_GET['start'])) {
         $num_skip = (int) $_GET['start'];
     }
     if (isset($_GET['length'])) {
         $num_items = (int) $_GET['length'];
     }
     if (isset($_GET['search'])) {
         $search_value = $_GET['search']['value'];
     }
     $all_services = Service::orderBy('id', 'DESC');
     if (!empty($search_value)) {
         $all_services->whereRaw("(services.name LIKE '%" . $search_value . "%')");
     }
     $recordsTotal = $all_services->count();
     $recordsFiltered = $recordsTotal;
     if ($num_skip > 0) {
         $all_services->skip($num_skip);
     }
     $all_services = $all_services->orderBy('id', 'DESC')->take($num_items)->get();
     $data = [];
     foreach ($all_services as $service) {
         // load cat relation
         $load_curr_category = $service->category;
         $load_curr_status = $service->status;
         $load_curr_period = $service->period;
         //Debugbar::info($service);
         $curr_category = $service->category !== NULL ? (object) ['id' => $service->category->id, 'name' => utf8_encode($service->category->name)] : (object) null;
         $curr_status = $service->status !== NULL ? (object) ['id' => $service->status_id, 'description' => utf8_encode($service->status->description)] : (object) null;
         $curr_period = $service->period !== NULL ? (object) ['id' => $service->invoice_periods_id, 'description' => utf8_encode($service->period->description)] : (object) null;
         $data[] = (object) ['DT_RowId' => 'row_' . $service->id, 'service_categories' => $curr_category, 'services' => $service, 'statuses' => $curr_status, 'invoice_periods' => $curr_period];
     }
     $ret = ['recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data, 'service_categories' => $this->getAllServiceCategories(), 'statuses' => $this->getAllStatuses(), 'invoice_periods' => $this->getAllInvoicePeriods()];
     return Response::json($ret);
 }
 /**
  * Display a listing of the resource.
  * GET /services
  *
  * @return Response
  */
 public function index()
 {
     $services = Service::orderBy('service')->get();
     return View::make('services.index')->withServices($services);
 }
 public function services()
 {
     $this->data['services'] = Service::orderBy('name')->paginate(10);
     return $this->layout->content = View::make('services', $this->data);
 }