Ejemplo n.º 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param Venue $venue
  * @return Response
  * @internal param int $id
  */
 public function edit(Venue $venue)
 {
     $features = Feature::lists('feature', 'id');
     $cities = City::lists('name', 'id');
     $types = Type::lists('type', 'id');
     return view('venues.edit', compact('venue', 'features', 'cities', 'types'));
 }
Ejemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     // disable foreign key constraints
     DB::table('features')->truncate();
     /*
             Feature::create([
                 'href' => '/dm/home',
                 'btnclass' => 'btn-success',
                 'innerhtml' => '个人信息'
             ]);
     */
     Feature::create(['href' => '/patient', 'btnclass' => 'btn-primary', 'innerhtml' => '患者资料']);
     /*
             Feature::create([
                 'href' => '/case',
                 'btnclass' => 'btn-info',
                 'innerhtml' => '方案管理'
             ]);
     */
     Feature::create(['href' => '/bdata', 'btnclass' => 'btn-danger', 'innerhtml' => '血糖管理']);
     DB::table('hasfeatures')->truncate();
     Hasfeature::create(['user_id' => 2, 'feature_id' => 1]);
     Hasfeature::create(['user_id' => 2, 'feature_id' => 2]);
     /*
             Hasfeature::create([
                 'user_id' => 2,
                 'feature_id' => 3
             ]);
     */
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     // enable foreign key constraints
 }
 public function run()
 {
     $features = ['Garden', 'Open Fire', 'Growler Fill', 'Take your own food'];
     foreach ($features as $feature) {
         Feature::create(['feature' => $feature]);
         $this->command->info('Creating ' . $feature);
     }
 }
Ejemplo n.º 4
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $result = Hasfeature::orderBy('id', 'ASC');
     $countstr = '操作';
     $count = $result->count();
     $users = User::where('is_admin', 0)->orderBy('id', 'DESC')->lists('name', 'id');
     $features = Feature::all();
     // lists('innerhtml', 'id');
     return view('Hasfeature.create', compact('countstr', 'count', 'users', 'features'));
 }
Ejemplo n.º 5
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $feature = Feature::findOrFail($id);
     $input = $request->except('_method', '_token');
     if ($feature->update($input)) {
         return redirect('/features');
     } else {
         return redirect("/features/{$id}/edit");
     }
 }
Ejemplo n.º 6
0
 /**
  * Show tree , use send data from client ajax
  * @param  [int] $id
  * @return void
  */
 public function showTree($id)
 {
     $features = Feature::where('module_id', '=', $id)->where('parent_id', '=', 0)->get();
     if (count($features) == 0) {
         echo "";
     } else {
         echo "<table class='tree table'>";
         foreach ($features as $k_fea => $val_fea) {
             echo "<tr class='treegrid-" . $val_fea->id . "'><td>" . $val_fea->name_feature . "</td></tr>";
             $items = FeatureNode::descendantsOf($val_fea->id);
             $items->linkNodes();
             $items = $items->toTree();
             echo $this->echoRecurTreeView($items);
         }
         echo "</table>";
     }
 }
Ejemplo n.º 7
0
 public static function actionSchema()
 {
     $permissions = [];
     $action_schemas = [];
     $permissions = Feature::getPermissionsByModule('role', 'table');
     $panel_permissions = Feature::getPermissionsByModule('role', 'panel');
     $user_table_permissions = Feature::getPermissionsByModule('role', 'user_table');
     foreach ($permissions as $permission) {
         $action_schemas['table'][] = ActionSchema::action($permission);
     }
     foreach ($panel_permissions as $panel_permission) {
         $action_schemas['panel'][] = ActionSchema::action($panel_permission);
     }
     foreach ($user_table_permissions as $user_table_permission) {
         $action_schemas['user_table'][] = ActionSchema::action($user_table_permission);
     }
     return $action_schemas;
 }
Ejemplo n.º 8
0
 public static function getActionSchema($module)
 {
     $permissions = [];
     $action_schemas = [];
     $permissions = Feature::getPermissionsByModule($module, 'table');
     foreach ($permissions as $permission) {
         $action_schemas['table'][] = self::action($permission);
     }
     $panel_permissions = Feature::getPermissionsByModule($module, 'panel-default');
     foreach ($panel_permissions as $panel_permission) {
         $action_schemas['panel-default'][] = self::action($panel_permission);
     }
     $panel2_permissions = Feature::getPermissionsByModule($module, 'panel-with-modal-delete');
     foreach ($panel2_permissions as $panel2_permission) {
         $action_schemas['panel-with-modal-delete'][] = ActionSchema::action($panel2_permission);
     }
     $panel3_permissions = Feature::getPermissionsByModule($module, 'user_table');
     foreach ($panel3_permissions as $panel3_permission) {
         $action_schemas['user_table'][] = ActionSchema::action($panel3_permission);
     }
     return $action_schemas;
 }
Ejemplo n.º 9
0
 /**
  * Create menu
  *
  * @param  [array] $arrparent
  * @param  [int] $id
  * @param  [array] $url
  * @param  [string] $name
  * @return [string]
  */
 public function createParent($arrparent, $id, $url, $name)
 {
     $str = "";
     $features = \App\Feature::where('parent_id', '=', $id)->get();
     array_push($this->check_feature, $id);
     if (count($features) > 0) {
         $str = "<li class='treeview'><a href='{$url}'><i class=''></i> {$name} <i class='fa fa-angle-left pull-right'></i></a><ul class='treeview-menu'>";
         $newstr = "";
         $number = 0;
         foreach ($features as $feature) {
             if ($feature->is_menu == 1 && in_array(array($feature->id => $feature->url_action), $this->listfeaturegroup) && !in_array($feature->id, $this->check_feature)) {
                 $number++;
                 array_push($this->check_feature, $feature->id);
                 $fj = json_decode($feature->url_action);
                 $link = "";
                 if ($fj == NULL) {
                     $link = route($feature->url_action);
                 } else {
                     $link = route($fj[0]);
                 }
                 $newstr .= $this->createParent($arrparent, $feature->id, $link, $feature->name_feature);
             }
         }
         if ($number == 1) {
             $str = $newstr;
         } else {
             if ($newstr == "") {
                 $str = "<li><a href='{$url}'><i class=''></i>{$name}</a></li>";
             } else {
                 $str .= $newstr . "</ul></li>";
             }
         }
     } else {
         $str = "<li><a href='{$url}'><i class=''></i>{$name}</a></li>";
     }
     return $str;
 }
Ejemplo n.º 10
0
 public function upload_feature(Request $request)
 {
     $this->validate($request, Feature::rules());
     $feature = Feature::where('id', $request->feature_id)->first();
     $feature->href = $request->href;
     $feature->btnclass = $request->btnclass;
     $feature->innerhtml = $request->innerhtml;
     $feature->save();
     session()->flash('message', '功能更新成功');
     return Redirect::back();
 }
Ejemplo n.º 11
0
 public static function actionSchema()
 {
     $permissions = [];
     $action_schemas = [];
     $permissions = Feature::getPermissionsByModule('user', 'table');
     foreach ($permissions as $permission) {
         $action_schemas['table'][] = ActionSchema::action($permission);
     }
     $panel_permissions = Feature::getPermissionsByModule('user', 'panel-default');
     foreach ($panel_permissions as $panel_permission) {
         $action_schemas['panel-default'][] = ActionSchema::action($panel_permission);
     }
     return $action_schemas;
 }
Ejemplo n.º 12
0
 /**
  * Create a new user controller instance.
  *
  * @return void
  */
 public function __construct()
 {
     $this->priviledge_user();
     $this->_subject_features = Feature::lists('name', 'id');
 }
Ejemplo n.º 13
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $feature = Feature::find($id);
     $feature->group()->detach();
     $feature->delete();
     return redirect()->route('features.index')->with('messageDelete', 'Delete feature success!');
 }
Ejemplo n.º 14
0
 public static function getFeaturesNotAssignedToCurrentRole($rid)
 {
     $features = [];
     $array = [0];
     $features = Role::find($rid)->features()->wherePivot('deleted_at', Null)->get();
     foreach ($features as $f) {
         $array[] = $f->id;
     }
     //if(!isset($array)) return [];
     $feature_result = Feature::whereNotIn('id', $array)->get();
     return $feature_result;
 }
Ejemplo n.º 15
0
 public static function getPermissionsByModule($module, $position)
 {
     //get the permission by their module...
     return Feature::where('module', $module)->first()->permissions()->where('position', $position)->get();
 }
Ejemplo n.º 16
0
 function _featuresRelationships()
 {
     return Feature::with(['post' => function ($query) {
         $query->select('id', 'title', 'description', 'slug');
     }]);
 }
Ejemplo n.º 17
0
 public function assignRoleFeatureForm($role_id)
 {
     $assigned_feature_ids = FeatureRole::where('role_id', $role_id)->lists('feature_id');
     $features_not_in_role = [];
     if ($assigned_feature_ids) {
         $features_not_in_role = Feature::whereNotIn('id', $assigned_feature_ids)->get();
     }
     $role = Role::find($role_id);
     return view('backend.role.feature_assign')->with('content_title', "Assign Feature")->with('features_not_in_role', $features_not_in_role)->with('role', $role)->with('module', $this->module);
 }
Ejemplo n.º 18
0
 /**
  * Create a new user controller instance.
  *
  * @return void
  */
 public function __construct()
 {
     $this->priviledge_user();
     $this->_room_buildings = Building::lists('name', 'id');
     $this->_room_features = Feature::lists('name', 'id');
 }
Ejemplo n.º 19
0
 public function shows($id)
 {
     return Feature::find($id);
 }
Ejemplo n.º 20
0
 public function createPermission($fid)
 {
     $feature = Feature::find($fid);
     if (!isset($feature)) {
         return Redirect::to('/crm/feature')->withMessage(Generate::message('Invalid', 'Invalid Feature or Feature has been deleted'));
     }
     $all_positions = Permission::getAllCurrentPosition();
     $icons = SysConfig::getSystemConfig('Icons');
     $icon_bgs = SysConfig::getSystemConfig('IconBG');
     $all_pages = Permission::getAllCurrentPages();
     $all_prompt_types = Permission::getAllCurrentPromptTypes();
     return view('backend.feature.create_permission')->with('content_title', 'Create New Permission')->with('feature', $feature)->with('icons', $icons)->with('icon_bgs', $icon_bgs)->with('all_prompt_types', $all_prompt_types)->with('all_pages', $all_pages)->with('all_positions', $all_positions)->with('module', $this->module);
 }