本文整理汇总了PHP中Acl::isSuperAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP Acl::isSuperAdmin方法的具体用法?PHP Acl::isSuperAdmin怎么用?PHP Acl::isSuperAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acl
的用法示例。
在下文中一共展示了Acl::isSuperAdmin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteComment
public function deleteComment()
{
if (!Acl::isSuperAdmin()) {
return Redirect::route('home');
}
$id = e(Input::get('id'));
$comment = Comment::find($id);
$comment->delete();
return Redirect::back()->with('success', trans('directory.comment_deleted'));
}
示例2: isAdminFilter
public function isAdminFilter($entity_name, $entity_id)
{
if (\Auth::check()) {
if (\Acl::isSuperAdmin()) {
return true;
}
return \Access::where('user_id', \Auth::user()->id)->where('entity_name', $entity_name)->where('entity_id', $entity_id)->count();
}
return false;
}
示例3: deleteHandle
public function deleteHandle($id)
{
$domain = Domain::find($id);
if (Acl::isAdmin($domain) || Acl::isSuperAdmin()) {
DB::statement('SET FOREIGN_KEY_CHECKS=0');
$domain->siteViewers()->delete();
$domain->domainVotes()->delete();
$domain->delete();
DB::statement('SET FOREIGN_KEY_CHECKS=0');
try {
$path_details = explode("/", $domain->thumb, 2);
$folder = $path_details[0];
File::deleteDirectory(public_path('assets/thumbs/' . $folder));
} catch (Exception $e) {
}
return Redirect::route('domains-pending')->with('success', trans('directory.domain_deleted'));
}
return Redirect::back()->with('error', Lang::get('directory.delete_denied', ['domain' => $domain->name]));
}
示例4: trans
<?php
$comments = Comment::where('domain_id', $domain->id);
if (!Acl::isSuperAdmin()) {
$comments = $comments->where('status', 1);
}
$comments = $comments->orderBy('created_at', 'DESC')->get();
?>
<div class="col-md-12 bottom" style="background-color: #FFF;">
<h4 style="margin-bottom: 20px;">{{ trans('directory.comments') }} ( {{ $comments->count() }} )</h4>
</div>
@if(empty($comments))
{{ trans('directory.no_comments') }}
@else
@foreach($comments as $comment)
<div class="bottom col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding: 20px 0;">
<?php
$adder = User::find($comment->user_id) ? User::find($comment->user_id)->firstname : trans('general.anonymous_user');
?>
{{ trans('general.in') }} {{ date("d-m-Y", strtotime($comment->created_at)) }} {{ $comment->user_id }} {{ $adder }} {{ trans('general.wrote') }}:<br />
<q>{{ $comment->comment }}</q>
<br />
@if(Acl::isSuperAdmin())
<div class="col-xs-4">
<a href="{{ URL::route('comment-edit', [$comment->id]) }}" class="btn btn-info">
{{ trans('general.edit') }}
</a>
</div>
{{ Form::open(['route' => 'approve-disapprove-comment', 'class' => 'col-xs-4 form-horizontal']) }}
示例5: editHandle
public function editHandle()
{
$id = e(Input::get('id'));
$category = Category::find($id);
$path = DirectoryHelpers::seoString(e(Input::get('path')));
$nice_input_names = ['is_root' => trans('directory.is_root'), 'name' => trans('directory.name'), 'path' => trans('directory.path'), 'description' => trans('directory.description'), 'keywords' => trans('directory.keywords')];
$rules = ['is_root' => 'required', 'name' => 'required|between:2,50|unique:categories,name,' . $id, 'path' => 'required|between:2,50|unique:categories,path,' . $id, 'description' => 'between:5,1000', 'keywords' => 'between:5,255'];
$is_root = Input::get('is_root');
if ('no' == $is_root) {
$nice_input_names['parent_id'] = trans('directory.parent');
if ($id == Input::get('parent_id')) {
//return Redirect::route('category.edit', [$id])->with('error', trans('directory.same_category_choosen'))->withInput();
}
}
$validator = Validator::make(Input::all(), $rules, [], $nice_input_names);
if ($validator->fails()) {
return Redirect::route('category.edit', [$id])->withErrors($validator)->withInput();
}
$status = Acl::isSuperAdmin() ? 1 : 0;
$category->update(['status' => $status, 'name' => e(Input::get('name')), 'slug' => $path, 'path' => $path, 'description' => e(Input::get('description')), 'keywords' => e(Input::get('keywords'))]);
try {
if ('yes' == $is_root) {
$category->makeRoot();
}
if ('no' == $is_root) {
$parent = Category::find(e(Input::get('parent_id')));
if ($id != Input::get('parent_id') && !$parent->isDescendantOf($category)) {
$category->makeChildOf($parent);
}
}
return Redirect::route('category.edit', [$id])->with('success', Lang::get('directory.category_updated', ['category' => $category->name]));
} catch (Exception $ex) {
dd($ex->getMessage());
return Redirect::route('category.edit', [$id])->withErrors($ex->getMessage())->withInput();
}
}