@@ -22,13 +22,13 @@ |
||
| 22 | 22 | public function creators() |
| 23 | 23 | { |
| 24 | 24 | return $this->belongsTo(User::class, 'created_by', 'id') |
| 25 | - ->withDefault(['name' => '-']); |
|
| 25 | + ->withDefault(['name' => '-']); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function editors() |
| 29 | 29 | { |
| 30 | 30 | return $this->belongsTo(User::class, 'modifed_by', 'id') |
| 31 | - ->withDefault(['name' => '-']); |
|
| 31 | + ->withDefault(['name' => '-']); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | //observers |
@@ -36,14 +36,14 @@ |
||
| 36 | 36 | { |
| 37 | 37 | parent::boot(); |
| 38 | 38 | |
| 39 | - self::creating(function ($model) { |
|
| 39 | + self::creating(function($model) { |
|
| 40 | 40 | if (Auth()->check()) { |
| 41 | 41 | $model->created_by = Auth()->user()->id; |
| 42 | 42 | $model->modifed_by = Auth()->user()->id; |
| 43 | 43 | } |
| 44 | 44 | }); |
| 45 | 45 | |
| 46 | - self::updating(function ($model) { |
|
| 46 | + self::updating(function($model) { |
|
| 47 | 47 | if (Auth()->check()) { |
| 48 | 48 | $model->modifed_by = Auth()->user()->id; |
| 49 | 49 | } |
@@ -13,11 +13,11 @@ |
||
| 13 | 13 | \App\Models\Script::class => 'App\Admin\Sections\Scripts', |
| 14 | 14 | \App\Setting::class => 'App\Admin\Sections\Settings', |
| 15 | 15 | |
| 16 | - ]; |
|
| 16 | + ]; |
|
| 17 | 17 | |
| 18 | 18 | protected $widgets = [ |
| 19 | 19 | \App\Admin\Widgets\NavigationUserBlock::class, |
| 20 | - ]; |
|
| 20 | + ]; |
|
| 21 | 21 | |
| 22 | 22 | public function boot(\SleepingOwl\Admin\Admin $admin) |
| 23 | 23 | { |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | Script::observe(ScriptObserver::class); |
| 36 | 36 | Setting::observe(SettingObserver::class); |
| 37 | 37 | |
| 38 | - Gate::define('admin-only', function ($user) { |
|
| 38 | + Gate::define('admin-only', function($user) { |
|
| 39 | 39 | if ($user->isAdmin() || $user->isModerator()) { |
| 40 | 40 | return true; |
| 41 | 41 | } |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | protected function mapWebRoutes() |
| 53 | 53 | { |
| 54 | 54 | Route::middleware('web') |
| 55 | - ->namespace($this->namespace) |
|
| 56 | - ->group(base_path('routes/web.php')); |
|
| 55 | + ->namespace($this->namespace) |
|
| 56 | + ->group(base_path('routes/web.php')); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | protected function mapApiRoutes() |
| 67 | 67 | { |
| 68 | 68 | Route::prefix('api') |
| 69 | - ->middleware('api') |
|
| 70 | - ->namespace($this->namespace) |
|
| 71 | - ->group(base_path('routes/api.php')); |
|
| 69 | + ->middleware('api') |
|
| 70 | + ->namespace($this->namespace) |
|
| 71 | + ->group(base_path('routes/api.php')); |
|
| 72 | 72 | } |
| 73 | 73 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | * @var array |
| 46 | 46 | */ |
| 47 | 47 | protected $casts = [ |
| 48 | - 'email_verified_at' => 'datetime', |
|
| 48 | + 'email_verified_at' => 'datetime', |
|
| 49 | 49 | ]; |
| 50 | 50 | |
| 51 | 51 | public function isAdmin() |
@@ -12,6 +12,6 @@ |
||
| 12 | 12 | * @var array |
| 13 | 13 | */ |
| 14 | 14 | protected $except = [ |
| 15 | - 'token', 'menu-state', |
|
| 15 | + 'token', 'menu-state', |
|
| 16 | 16 | ]; |
| 17 | 17 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | if (Cache::has('t_'.$this->apiKey)) { |
| 31 | 31 | $check = Cache::get('t_'.$this->apiKey); |
| 32 | 32 | } else { |
| 33 | - $check = Cache::remember('t_'.$this->apiKey, $cache_time_forever, function () { |
|
| 33 | + $check = Cache::remember('t_'.$this->apiKey, $cache_time_forever, function() { |
|
| 34 | 34 | $m1token = Token::where('api_token', $this->apiKey)->first(); |
| 35 | 35 | |
| 36 | 36 | return $m1token; |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | cache()->flush(); |
| 15 | 15 | |
| 16 | 16 | return redirect() |
| 17 | - ->back() |
|
| 18 | - ->with(['success_message' => __('api.admin.cache_clear')]); |
|
| 17 | + ->back() |
|
| 18 | + ->with(['success_message' => __('api.admin.cache_clear')]); |
|
| 19 | 19 | } |
| 20 | 20 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | public function __construct() |
| 21 | 21 | { |
| 22 | 22 | $this->middleware('auth') |
| 23 | - ->only(['logout_get', 'logout']); |
|
| 23 | + ->only(['logout_get', 'logout']); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function robot() |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | return response()->json([ |
| 39 | 39 | 'success' => false, |
| 40 | 40 | 'error' => $this->robot(), |
| 41 | - ], 403); |
|
| 41 | + ], 403); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $user = new User(); |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | return response()->json([ |
| 53 | 53 | 'success' => false, |
| 54 | 54 | 'error' => __('api.errors.register'), |
| 55 | - ]); |
|
| 55 | + ]); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | return response()->json([ |
| 59 | - 'success' => false, |
|
| 60 | - 'error' => __('auth.needactive'), |
|
| 59 | + 'success' => false, |
|
| 60 | + 'error' => __('auth.needactive'), |
|
| 61 | 61 | ], 403); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | return response()->json([ |
| 73 | 73 | 'success' => false, |
| 74 | 74 | 'error' => $this->robot(), |
| 75 | - ], 403); |
|
| 75 | + ], 403); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $credentials = [ |
| 79 | - 'email' => $request->email, |
|
| 80 | - 'password' => $request->password, |
|
| 79 | + 'email' => $request->email, |
|
| 80 | + 'password' => $request->password, |
|
| 81 | 81 | ]; |
| 82 | 82 | |
| 83 | 83 | if (Auth::attempt($credentials)) { |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | Auth::logout(); |
| 86 | 86 | if (!$user->active) { |
| 87 | 87 | return response()->json([ |
| 88 | - 'success' => false, |
|
| 89 | - 'error' => __('auth.deactive'), |
|
| 88 | + 'success' => false, |
|
| 89 | + 'error' => __('auth.deactive'), |
|
| 90 | 90 | ], 403); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -95,18 +95,18 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | if (isset($token->api_token)) { |
| 97 | 97 | return response()->json([ |
| 98 | - 'success' => true, |
|
| 99 | - 'user_id' => $user->id, |
|
| 100 | - 'user_name' => $user->name, |
|
| 101 | - 'user_email' => $user->email, |
|
| 102 | - 'api_token' => $token->api_token, |
|
| 98 | + 'success' => true, |
|
| 99 | + 'user_id' => $user->id, |
|
| 100 | + 'user_name' => $user->name, |
|
| 101 | + 'user_email' => $user->email, |
|
| 102 | + 'api_token' => $token->api_token, |
|
| 103 | 103 | ]); |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | return response()->json([ |
| 108 | - 'success' => false, |
|
| 109 | - 'error' => __('auth.failed'), |
|
| 108 | + 'success' => false, |
|
| 109 | + 'error' => __('auth.failed'), |
|
| 110 | 110 | ], 403); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $token_data->clear_token($request->bearerToken()); |
| 125 | 125 | |
| 126 | 126 | return response()->json([ |
| 127 | - 'success' => true, |
|
| 127 | + 'success' => true, |
|
| 128 | 128 | ]); |
| 129 | 129 | } |
| 130 | 130 | } |