Added const for user level
This commit is contained in:
@@ -148,7 +148,7 @@ class SetupController extends Controller
|
|||||||
'username' => $userDetails['username'],
|
'username' => $userDetails['username'],
|
||||||
'email' => $userDetails['email'],
|
'email' => $userDetails['email'],
|
||||||
'password' => $userDetails['password'],
|
'password' => $userDetails['password'],
|
||||||
'level' => 1,
|
'level' => User::LEVEL_ADMIN,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Auth::login($user);
|
Auth::login($user);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use AltThree\Validator\ValidationException;
|
|||||||
use CachetHQ\Cachet\Commands\Invite\ClaimInviteCommand;
|
use CachetHQ\Cachet\Commands\Invite\ClaimInviteCommand;
|
||||||
use CachetHQ\Cachet\Commands\User\SignupUserCommand;
|
use CachetHQ\Cachet\Commands\User\SignupUserCommand;
|
||||||
use CachetHQ\Cachet\Models\Invite;
|
use CachetHQ\Cachet\Models\Invite;
|
||||||
|
use CachetHQ\Cachet\Models\User;
|
||||||
use GrahamCampbell\Binput\Facades\Binput;
|
use GrahamCampbell\Binput\Facades\Binput;
|
||||||
use Illuminate\Routing\Controller;
|
use Illuminate\Routing\Controller;
|
||||||
use Illuminate\Support\Facades\Redirect;
|
use Illuminate\Support\Facades\Redirect;
|
||||||
@@ -73,7 +74,7 @@ class SignupController extends Controller
|
|||||||
Binput::get('username'),
|
Binput::get('username'),
|
||||||
Binput::get('password'),
|
Binput::get('password'),
|
||||||
Binput::get('email'),
|
Binput::get('email'),
|
||||||
2
|
User::LEVEL_USER
|
||||||
));
|
));
|
||||||
} catch (ValidationException $e) {
|
} catch (ValidationException $e) {
|
||||||
return Redirect::route('signup.invite', ['code' => $invite->code])
|
return Redirect::route('signup.invite', ['code' => $invite->code])
|
||||||
|
|||||||
+15
-1
@@ -24,6 +24,20 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
|||||||
{
|
{
|
||||||
use Authenticatable, CanResetPassword, ValidatingTrait;
|
use Authenticatable, CanResetPassword, ValidatingTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The admin level of user.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
const LEVEL_ADMIN = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The general level of user.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
const LEVEL_USER = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be casted to native types.
|
* The attributes that should be casted to native types.
|
||||||
*
|
*
|
||||||
@@ -144,7 +158,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
|||||||
*/
|
*/
|
||||||
public function getIsAdminAttribute()
|
public function getIsAdminAttribute()
|
||||||
{
|
{
|
||||||
return $this->level == 1;
|
return $this->level == self::LEVEL_ADMIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user