本文整理汇总了PHP中App\Http\Requests\Auth类的典型用法代码示例。如果您正苦于以下问题:PHP Auth类的具体用法?PHP Auth怎么用?PHP Auth使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Auth类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
if ($this->isUpdate()) {
return Post::findOrFail($this->get('id'))->user_id == \Auth::id();
}
return \Auth::check();
}
示例2: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
if (Auth::check() && Auth::user()->hasAccess('create_paper')) {
return true;
}
return false;
}
示例3: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
if (\Auth::check()) {
return true;
}
return false;
}
示例4: authorize
public function authorize()
{
// Only allow logged in users
return \Auth::check();
// Allows all users in
// return true;
}
示例5: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
if (\Auth::user()->isModerator()) {
return true;
}
return false;
}
示例6: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$id = $this->route('id');
if ($id == 0) {
return TRUE;
}
return \Auth::user()->owns(\App\AmazonProduct::find($id));
}
示例7: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
if (\Auth::guest()) {
return false;
} else {
return true;
}
}
示例8: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
if (\Auth::user()->level->id == 1) {
return true;
} else {
return false;
}
}
示例9: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$profile = $this->route('profiles');
if (!is_null($user = \Auth::user())) {
return $user->is_admin || !is_null($user->profile) && $user->profile->id == $profile;
}
return false;
}
示例10: validator
/**
* Check when user updates details, that if email has changed it is not taken by another user.
*/
public function validator()
{
$validator = Validator::make($this->input(), $this->rules(), $this->messages());
$validator->sometimes('email', 'unique:users', function ($input) {
return $input->email != \Auth::user()->email;
});
return $validator;
}
示例11: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$user = \Auth::user();
if ($user->hasRoles(['admin', 'super admin'])) {
return true;
} else {
return false;
}
}
示例12: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$user = Auth::user();
$group_id = $this->route('group');
// Есть ли права на запись
// является ли пользователь админом
// и админ ли он этой группы
return $user->is_admin && GroupAdmin::where('admin_id', $user->id)->where('group_id', $group_id)->exists();
}
示例13: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$reportId = $this->route('id');
$report = ExpenseReport::find($reportId);
if ($report->owner_id == \Auth::user()->id) {
return true;
}
return false;
}
示例14: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$reportId = $this->route('id');
$report = ExpenseReport::findOrFail($reportId);
if ($report->users()->get(['id'])->contains(\Auth::user()->id) || $report->owner_id == \Auth::user()->id) {
return true;
}
return false;
}
示例15: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if (isset(\Auth::user()->site_id)) {
$sites_ids = SiteLanguages::site_access()->select(\DB::raw(' GROUP_CONCAT(id) as sites_ids'))->groupBy('sites_id')->get();
$site_access = 'in:' . $sites_ids[0]->sites_ids;
} else {
$site_access = '';
}
return ['sitelanguages_id' => 'required|' . $site_access, 'title' => 'required|unique:topmenus,title,' . $this->topmenus, 'link' => 'required'];
}