コード例 #1
0
 public function ajax()
 {
     if (Request::ajax()) {
         $post = Input::all();
         if (isset($post['action']) && !empty($post['action'])) {
             switch ($post['action']) {
                 case 'service-add':
                     $data = array('business_id' => Auth::user()->business->id, 'name' => $post['service_name']);
                     $group = ServiceGroup::create($data);
                     $group['business_id'] = Auth::user()->business->id;
                     echo View::make('business::ajax.new_group', $group);
                     exit;
                     break;
                 case 'remove-salon-image':
                     $key = $post['key'];
                     echo Auth::user()->business->remove_extra_image($key);
                     exit;
                     break;
                 default:
                     # code...
                     break;
             }
         }
     }
 }