本文整理汇总了PHP中access函数的典型用法代码示例。如果您正苦于以下问题:PHP access函数的具体用法?PHP access怎么用?PHP access使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了access函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDeleteButtonAttribute
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->can('delete-permissions')) {
return '<a href="' . route('admin.access.roles.permissions.destroy', $this->id) . '" class="btn btn-xs btn-danger" data-method="delete"><i class="fa fa-times" data-toggle="tooltip" data-placement="top" title="' . trans('crud.delete_button') . '"></i></a>';
}
return '';
}
示例2: getDeleteButtonAttribute
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->allow('delete-categories')) {
return '<a href="' . route('admin.quiz.categories.destroy', $this->id) . '" data-method="delete" class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.general.crud.delete') . '"></i></a>';
}
return '';
}
示例3: handle
/**
* @param $request
* @param callable $next
* @param $permission
* @return mixed
*/
public function handle($request, Closure $next, $permission)
{
if (!access()->allow($permission)) {
return redirect()->route('frontend.index')->withFlashDanger(trans('auth.general_error'));
}
return $next($request);
}
示例4: getDeleteButtonAttribute
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->can('destroy-team')) {
return '<a href="' . route('team.destroy', $this->id) . '" data-method="delete" class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . trans('crud.delete_button') . '"></i></a>';
}
return '';
}
示例5: getResultsButtonAttribute
/**
* @return string
*/
public function getResultsButtonAttribute()
{
if (access()->allow('see-results') && $this->isCompleted()) {
return '<a href="' . route('admin.quiz.results.show', $this->id) . '" class="btn btn-xs btn-primary"><i class="fa fa-list" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.quiz.tasks.results') . '"></i></a>';
}
return '';
}
示例6: getDeleteButtonAttribute
/**
* @return string
*/
public function getDeleteButtonAttribute()
{
if (access()->can('view-innovate-ecommerce')) {
return '<a href="' . route('admin.check_out_agreement.destroy', $this->id) . '" data-method="delete" class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . trans('crud.delete_button') . '"></i></a>';
}
return '';
}
示例7: loginAs
/**
* @param User $user
* @param ManageUserRequest $request
* @return \Illuminate\Http\RedirectResponse
* @throws GeneralException
*/
public function loginAs(User $user, ManageUserRequest $request)
{
// Overwrite who we're logging in as, if we're already logged in as someone else.
if (session()->has('admin_user_id') && session()->has('temp_user_id')) {
// Let's not try to login as ourselves.
if (access()->id() == $user->id || session()->get('admin_user_id') == $user->id) {
throw new GeneralException('Do not try to login as yourself.');
}
// Overwrite temp user ID.
session(['temp_user_id' => $user->id]);
// Login.
access()->loginUsingId($user->id);
// Redirect.
return redirect()->route("frontend.index");
}
app()->make(Auth::class)->flushTempSession();
// Won't break, but don't let them "Login As" themselves
if (access()->id() == $user->id) {
throw new GeneralException("Do not try to login as yourself.");
}
// Add new session variables
session(["admin_user_id" => access()->id()]);
session(["admin_user_name" => access()->user()->name]);
session(["temp_user_id" => $user->id]);
// Login user
access()->loginUsingId($user->id);
// Redirect to frontend
return redirect()->route("frontend.index");
}
示例8: redirectPath
/**
* Where to redirect users after login / registration.
* @return string
*/
public function redirectPath()
{
if (access()->allow('view-backend')) {
return route('admin.dashboard');
}
return route('frontend.user.dashboard');
}
示例9: init
/**
* Init
*/
public function init()
{
parent::init();
if (access('Dev.*') && cogear()->config->development) {
hook('done', array($this, 'finish'));
}
}
示例10: handle
/**
* @param $request
* @param callable $next
* @param $role
* @return mixed
*/
public function handle($request, Closure $next, $role)
{
if (!access()->hasRole($role)) {
return redirect('/')->withFlashDanger("You do not have access to do that.");
}
return $next($request);
}
示例11: handle
/**
* @param $request
* @param callable $next
* @param $permission
*
* @return mixed
*/
public function handle($request, Closure $next, $permission)
{
if (!access()->can($permission)) {
return redirect('/')->withFlashDanger('You do not have access to do that.');
}
return $next($request);
}
示例12: hookRouterExec
/**
* Хук Роутера
*
* @param object $Router
* @param Callback $callback
*/
public function hookRouterExec($Router, Callback $callback)
{
if (!access($callback->getCallback(0)->gear . '.*') && !access($callback->getCallback(0)->gear . '.' . str_replace('_action', '', $callback->getCallback(1)))) {
event('403');
return FALSE;
}
}
示例13: browse
function browse()
{
$this->user_group_model->can_access(VIEW_LIST_NEWS, null, null);
$filter = '';
//view my news
if (!access(VIEW_ALL_NEWS)) {
$filter .= ' AND poster = ' . $_SESSION['userdata']['userid'];
}
$start = (int) $this->uri->segment(5, 0);
$limit_per_page = 30;
$cat_id = (int) $this->uri->segment(3, 0);
$newsType = $this->uri->segment(4, 'news');
$this->load->model('ci_newsmodel');
// Instantiate the model
$aryNewsList = array();
$aryNewsList = $this->ci_newsmodel->getNewsList($newsType, $cat_id, $start, $limit_per_page, $filter);
$the_results['aryNewsList'] = $aryNewsList;
$the_results['numOfNews'] = $this->ci_newsmodel->table_record_count;
$the_results['newsType'] = $newsType;
$this->load->library('pagination');
$this->load->helper('url');
$config['total_rows'] = $this->ci_newsmodel->table_record_count;
$config['per_page'] = $limit_per_page;
$config['uri_segment'] = 5;
$config['num_links'] = 3;
$config['base_url'] = base_url() . 'news/browse/' . $cat_id . '/' . $newsType;
$this->pagination->initialize($config);
$the_results['page_links'] = $this->pagination->create_links();
$the_results['title'] = 'News List';
$the_results['cat_id'] = $cat_id;
$this->_display('/ci_news/ci_newsgrid', $the_results);
}
示例14: handle
/**
* @param $request
* @param callable $next
* @param null $params
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Symfony\Component\HttpFoundation\Response
*/
public function handle($request, Closure $next, $params = null)
{
$assets = $this->getAssets($request, $params);
if (!access()->hasRoles($assets['roles'], $assets['needsAll'])) {
return $this->getRedirectMethodAndGo($request, $params);
}
return $next($request);
}
示例15: index
/**
* @return \Illuminate\View\View
*/
public function index()
{
$organizations = access()->user()->organizations()->get();
if (count($organizations) == 0) {
return redirect()->to('/');
}
$this_url = \Request::url();
return view('frontend.user_organizations')->with('this_url', $this_url)->with('organizations', $organizations);
}