本文整理汇总了PHP中Action::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::all方法的具体用法?PHP Action::all怎么用?PHP Action::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action
的用法示例。
在下文中一共展示了Action::all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make(Input::all(), Config::get('validator.admin.role'));
if ($validator->passes()) {
$role = new Role();
$role->name = Input::get('name');
$role->deletable = 1;
// Was the blog post created?
if ($role->save()) {
//Set all permission to deny
$resources = Resource::where('in_admin_ui', '=', 1)->get();
$data = array();
foreach ($resources as $resource) {
foreach (Action::all() as $action) {
$data[] = array('role_id' => $role->id, 'type' => 'deny', 'action_id' => $action->id, 'resource_id' => $resource->id);
}
}
DB::table('permissions')->insert($data);
//track user
parent::track('create', 'Role', $role->id);
return Redirect::to('admin/role_permission')->with('success', Lang::get('admin.role_save_success'));
}
// Redirect to the blog post create role
return Redirect::to('admin/role/create')->with('error', Lang::get('admin.role_save_fail'));
}
// Form validation failed
return Redirect::to('admin/role/create')->withInput()->withErrors($validator);
}
示例2: destroy
public function destroy($idMenu, $id)
{
$adminMenu = AdministrationMenu::find($idMenu);
$role = Role::find($id);
foreach (Action::all() as $action) {
DB::table('actions_roles_menu')->where('action_id', '=', $action->id)->where('role_id', '=', $role->id)->where('menu_admin_id', '=', $adminMenu->id)->softDeletes();
}
// redirect
Session::flash('message', 'Successfully deleted the menu!');
return Redirect::to('admin/access/' . $adminMenu->id);
}
示例3: policyRBACEditFrmAction
/**
* [policyRBACEditFrmAction Show form for edit rbac-policy]
* @param [integer] $id policy id
* @return [none] redirect to view
*/
public function policyRBACEditFrmAction($id)
{
$data['policy'] = Policy::find($id);
$data['role'] = Roles::all();
$data['data'] = Data::all();
$data['condition'] = Condition::all();
$data['action'] = Action::all();
$data['purpose'] = Purpose::all();
$data['obligation'] = Obligation::all();
// print '<pre>';
// print_r(self::policyRBACEditAction($id));
// exit();
return View::make('rbac.editrbac')->with('results', $data)->with('rbac_data', self::policyRBACEditAction($id));
}
示例4: foreach
<!-- if there are creation errors, they will show here -->
{{ HTML::ul($errors->all()) }}
{{ Form::open(array('url' => 'admin/access/'.$adminMenu->id.'/update/'.$role->id, 'method'=>'post')) }}
{{ Form::token() }}
<div class="form-group">
{{ Form::label('role', 'Actual Role:') }}
<input type="hidden" value="{{$role->id}}" name="oldRole" id="oldRole" />
{{ Form::select('role', ['' => ''] + Role::all()->lists('name', 'id'),$role->id) }}
</div>
<div class="form-group">
{{ Form::label('action', 'Action:') }}
<br>
<?php
foreach (Action::all() as $action) {
$find = false;
foreach ($role->actions()->getResults() as $checkboxAction) {
if ($checkboxAction->id === $action->id) {
$find = true;
break;
}
}
if ($find) {
echo Form::checkbox('actions[]', $checkboxAction->id, true, array("style", "padding-left:1.5em"));
echo '<label style="padding-right:0.5em" >' . $checkboxAction->name . '</label>';
} else {
echo Form::checkbox('actions[]', $action->id, false, array("style", "padding-left:1.5em"));
echo '<label style="padding-right:0.5em" >' . $action->name . '</label>';
}
}