コード例 #1
0
 /**
  * [searchAction description]
  * @param  [type] $keyword [description]
  * @return [type]          [description]
  */
 public function searchAction($keyword)
 {
     $training = new Training();
     $per_page = Config::get('nhc/site.perpage_training');
     $training_model = $training->getTrainByKeywork($keyword, $per_page);
     foreach ($training_model as $key => $val) {
         $role_id = explode(',', $val->target);
         $rs = Roles::whereIn('id', $role_id)->get(array('role_name'))->toArray();
         $role_name[$key] = implode(",", array_flatten($rs));
     }
     if (Request::ajax()) {
         $html = View::make('train.searchtrain')->with('paginator', $training_model)->with('relate_role', $role_name);
         return $html;
     }
 }