@@ -2,7 +2,6 @@ |
||
| 2 | 2 | namespace App\Modules\Core\Http\Controllers; |
| 3 | 3 | |
| 4 | 4 | use App\Http\Controllers\Controller; |
| 5 | -use Illuminate\Http\Request; |
|
| 6 | 5 | |
| 7 | 6 | class ApiDocumentController extends Controller |
| 8 | 7 | { |
@@ -20,27 +20,27 @@ discard block |
||
| 20 | 20 | ], |
| 21 | 21 | [ |
| 22 | 22 | 'title' => 'email equal [email protected] and user is blocked:', |
| 23 | - 'content' => ['and' => ['email' => '[email protected]','blocked' => 1]] |
|
| 23 | + 'content' => ['and' => ['email' => '[email protected]', 'blocked' => 1]] |
|
| 24 | 24 | ], |
| 25 | 25 | [ |
| 26 | 26 | 'title' => 'email equal [email protected] or user is blocked:', |
| 27 | - 'content' => ['or' => ['email' => '[email protected]','blocked' => 1]] |
|
| 27 | + 'content' => ['or' => ['email' => '[email protected]', 'blocked' => 1]] |
|
| 28 | 28 | ], |
| 29 | 29 | [ |
| 30 | 30 | 'title' => 'email contain John:', |
| 31 | - 'content' => ['email' => ['op' => 'like','val' => '%John%']] |
|
| 31 | + 'content' => ['email' => ['op' => 'like', 'val' => '%John%']] |
|
| 32 | 32 | ], |
| 33 | 33 | [ |
| 34 | 34 | 'title' => 'user created after 2016-10-25:', |
| 35 | - 'content' => ['created_at' => ['op' => '>','val' => '2016-10-25']] |
|
| 35 | + 'content' => ['created_at' => ['op' => '>', 'val' => '2016-10-25']] |
|
| 36 | 36 | ], |
| 37 | 37 | [ |
| 38 | 38 | 'title' => 'user created between 2016-10-20 and 2016-10-25:', |
| 39 | - 'content' => ['created_at' => ['op' => 'between','val1' => '2016-10-20','val2' => '2016-10-25']] |
|
| 39 | + 'content' => ['created_at' => ['op' => 'between', 'val1' => '2016-10-20', 'val2' => '2016-10-25']] |
|
| 40 | 40 | ], |
| 41 | 41 | [ |
| 42 | 42 | 'title' => 'user id in 1,2,3:', |
| 43 | - 'content' => ['id' => ['op' => 'in','val' => [1, 2, 3]]] |
|
| 43 | + 'content' => ['id' => ['op' => 'in', 'val' => [1, 2, 3]]] |
|
| 44 | 44 | ], |
| 45 | 45 | [ |
| 46 | 46 | 'title' => 'user name is null:', |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | ], |
| 53 | 53 | [ |
| 54 | 54 | 'title' => 'user has group admin:', |
| 55 | - 'content' => ['groups' => ['op' => 'has','val' => ['name' => 'Admin']]] |
|
| 55 | + 'content' => ['groups' => ['op' => 'has', 'val' => ['name' => 'Admin']]] |
|
| 56 | 56 | ] |
| 57 | 57 | ]; |
| 58 | 58 | |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use Illuminate\Notifications\Notification; |
| 7 | 7 | use Illuminate\Contracts\Queue\ShouldQueue; |
| 8 | 8 | use Illuminate\Notifications\Messages\MailMessage; |
| 9 | -use Illuminate\Notifications\Messages\BroadcastMessage; |
|
| 10 | 9 | |
| 11 | 10 | class ResetPassword extends Notification implements ShouldQueue |
| 12 | 11 | { |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | * Get the notification's delivery channels. |
| 27 | 27 | * |
| 28 | 28 | * @param mixed $notifiable |
| 29 | - * @return array |
|
| 29 | + * @return string[] |
|
| 30 | 30 | */ |
| 31 | 31 | public function via($notifiable) |
| 32 | 32 | { |
@@ -45,6 +45,6 @@ |
||
| 45 | 45 | ->subject('Reset passowrd') |
| 46 | 46 | ->line('Reset passowrd') |
| 47 | 47 | ->line('To reset your password click on the button below') |
| 48 | - ->action('Reset password', config('skeleton.reset_password_url') . '/' . $this->token); |
|
| 48 | + ->action('Reset password', config('skeleton.reset_password_url').'/'.$this->token); |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - DB::statement( "CREATE VIEW admin_count AS |
|
| 15 | + DB::statement("CREATE VIEW admin_count AS |
|
| 16 | 16 | select count(u.id) |
| 17 | 17 | from users u, groups g ,users_groups ug |
| 18 | 18 | where |
@@ -39,6 +39,6 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function down() |
| 41 | 41 | { |
| 42 | - DB::statement( "DROP VIEW IF EXISTS admin_count"); |
|
| 42 | + DB::statement("DROP VIEW IF EXISTS admin_count"); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | \ No newline at end of file |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('push_notifications_devices', function (Blueprint $table) { |
|
| 15 | + Schema::create('push_notifications_devices', function(Blueprint $table) { |
|
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | $table->string('device_token'); |
| 18 | 18 | $table->integer('user_id'); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('users', function (Blueprint $table) { |
|
| 15 | + Schema::create('users', function(Blueprint $table) { |
|
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | $table->string('profile_picture', 150)->nullable(); |
| 18 | 18 | $table->string('name', 100)->nullable(); |
@@ -13,31 +13,31 @@ |
||
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | 15 | Schema::create('users', function (Blueprint $table) { |
| 16 | - $table->increments('id'); |
|
| 17 | - $table->string('profile_picture', 150)->nullable(); |
|
| 18 | - $table->string('name', 100)->nullable(); |
|
| 19 | - $table->string('email')->unique(); |
|
| 20 | - $table->string('password', 60)->nullable(); |
|
| 21 | - $table->boolean('blocked')->default(0); |
|
| 22 | - $table->boolean('confirmed')->default(0); |
|
| 23 | - $table->string('confirmation_code')->nullable(); |
|
| 24 | - $table->softDeletes(); |
|
| 25 | - $table->rememberToken(); |
|
| 26 | - $table->timestamps(); |
|
| 27 | - }); |
|
| 16 | + $table->increments('id'); |
|
| 17 | + $table->string('profile_picture', 150)->nullable(); |
|
| 18 | + $table->string('name', 100)->nullable(); |
|
| 19 | + $table->string('email')->unique(); |
|
| 20 | + $table->string('password', 60)->nullable(); |
|
| 21 | + $table->boolean('blocked')->default(0); |
|
| 22 | + $table->boolean('confirmed')->default(0); |
|
| 23 | + $table->string('confirmation_code')->nullable(); |
|
| 24 | + $table->softDeletes(); |
|
| 25 | + $table->rememberToken(); |
|
| 26 | + $table->timestamps(); |
|
| 27 | + }); |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Create Default users. |
| 31 | 31 | */ |
| 32 | 32 | \DB::table('users')->insertGetId( |
| 33 | - [ |
|
| 33 | + [ |
|
| 34 | 34 | 'name' => 'Admin', |
| 35 | 35 | 'email' => '[email protected]', |
| 36 | 36 | 'password' => bcrypt('123456'), |
| 37 | 37 | 'created_at' => \DB::raw('NOW()'), |
| 38 | 38 | 'updated_at' => \DB::raw('NOW()') |
| 39 | 39 | ] |
| 40 | - ); |
|
| 40 | + ); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | public function assignPermissions($groupId, $permissionIds) |
| 25 | 25 | { |
| 26 | - \DB::transaction(function () use ($groupId, $permissionIds) { |
|
| 26 | + \DB::transaction(function() use ($groupId, $permissionIds) { |
|
| 27 | 27 | $group = $this->find($groupId); |
| 28 | 28 | $group->permissions()->detach(); |
| 29 | 29 | $group->permissions()->attach($permissionIds); |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | use App\Modules\Core\AbstractRepositories\AbstractRepositoryContainer; |
| 4 | 4 | |
| 5 | -class Core extends AbstractRepositoryContainer{ |
|
| 5 | +class Core extends AbstractRepositoryContainer { |
|
| 6 | 6 | /** |
| 7 | 7 | * Specify module repositories name space. |
| 8 | 8 | * |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use Illuminate\Notifications\Notification; |
| 7 | 7 | use Illuminate\Contracts\Queue\ShouldQueue; |
| 8 | 8 | use Illuminate\Notifications\Messages\MailMessage; |
| 9 | -use Illuminate\Notifications\Messages\BroadcastMessage; |
|
| 10 | 9 | |
| 11 | 10 | class ConfirmEmail extends Notification implements ShouldQueue |
| 12 | 11 | { |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * Get the notification's delivery channels. |
| 25 | 25 | * |
| 26 | 26 | * @param mixed $notifiable |
| 27 | - * @return array |
|
| 27 | + * @return string[] |
|
| 28 | 28 | */ |
| 29 | 29 | public function via($notifiable) |
| 30 | 30 | { |
@@ -43,6 +43,6 @@ |
||
| 43 | 43 | ->subject('Email verification') |
| 44 | 44 | ->line('Email verification') |
| 45 | 45 | ->line('To validate your email click on the button below') |
| 46 | - ->action('Verify your email', config('skeleton.confrim_email_url') . '/' . $notifiable->confirmation_code); |
|
| 46 | + ->action('Verify your email', config('skeleton.confrim_email_url').'/'.$notifiable->confirmation_code); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | \ No newline at end of file |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * Check if the logged in user has the given group. |
| 63 | 63 | * |
| 64 | - * @param array $groups |
|
| 64 | + * @param string[] $groups |
|
| 65 | 65 | * @param mixed $user |
| 66 | 66 | * @return boolean |
| 67 | 67 | */ |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @param array $credentials |
| 157 | 157 | * @param boolean $skipConfirmEmail |
| 158 | - * @return array |
|
| 158 | + * @return boolean |
|
| 159 | 159 | */ |
| 160 | 160 | public function register($credentials, $skipConfirmEmail = false) |
| 161 | 161 | { |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * Reset the given user's password. |
| 247 | 247 | * |
| 248 | 248 | * @param array $credentials |
| 249 | - * @return array |
|
| 249 | + * @return string|null |
|
| 250 | 250 | */ |
| 251 | 251 | public function resetPassword($credentials) |
| 252 | 252 | { |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $user = \Core::users()->find(\Auth::id(), $relations); |
| 29 | 29 | foreach ($user->groups()->get() as $group) |
| 30 | 30 | { |
| 31 | - $group->permissions->each(function ($permission) use (&$permissions){ |
|
| 31 | + $group->permissions->each(function($permission) use (&$permissions){ |
|
| 32 | 32 | $permissions[$permission->model][$permission->id] = $permission->name; |
| 33 | 33 | }); |
| 34 | 34 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $user = $user ?: $this->find(\Auth::id(), ['groups.permissions']); |
| 52 | 52 | $permissions = []; |
| 53 | 53 | |
| 54 | - $user->groups->pluck('permissions')->each(function ($permission) use (&$permissions, $model){ |
|
| 54 | + $user->groups->pluck('permissions')->each(function($permission) use (&$permissions, $model){ |
|
| 55 | 55 | $permissions = array_merge($permissions, $permission->where('model', $model)->pluck('name')->toArray()); |
| 56 | 56 | }); |
| 57 | 57 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function assignGroups($userId, $groupIds) |
| 82 | 82 | { |
| 83 | - \DB::transaction(function () use ($userId, $groupIds) { |
|
| 83 | + \DB::transaction(function() use ($userId, $groupIds) { |
|
| 84 | 84 | $user = $this->find($userId); |
| 85 | 85 | $user->groups()->detach(); |
| 86 | 86 | $user->groups()->attach($groupIds); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | public function resetPassword($credentials) |
| 252 | 252 | { |
| 253 | - $response = \Password::reset($credentials, function ($user, $password) { |
|
| 253 | + $response = \Password::reset($credentials, function($user, $password) { |
|
| 254 | 254 | $user->password = $password; |
| 255 | 255 | $user->save(); |
| 256 | 256 | }); |
@@ -102,20 +102,16 @@ discard block |
||
| 102 | 102 | if ( ! $user = $this->first(['email' => $credentials['email']])) |
| 103 | 103 | { |
| 104 | 104 | \ErrorHandler::loginFailed(); |
| 105 | - } |
|
| 106 | - else if ($adminLogin && ! $user->groups->whereIn('name', ['Admin'])->count()) |
|
| 105 | + } else if ($adminLogin && ! $user->groups->whereIn('name', ['Admin'])->count()) |
|
| 107 | 106 | { |
| 108 | 107 | \ErrorHandler::loginFailed(); |
| 109 | - } |
|
| 110 | - else if ( ! $adminLogin && $user->groups->whereIn('name', ['Admin'])->count()) |
|
| 108 | + } else if ( ! $adminLogin && $user->groups->whereIn('name', ['Admin'])->count()) |
|
| 111 | 109 | { |
| 112 | 110 | \ErrorHandler::loginFailed(); |
| 113 | - } |
|
| 114 | - else if ($user->blocked) |
|
| 111 | + } else if ($user->blocked) |
|
| 115 | 112 | { |
| 116 | 113 | \ErrorHandler::userIsBlocked(); |
| 117 | - } |
|
| 118 | - else if ( ! config('skeleton.disable_confirm_email') && ! $user->confirmed) |
|
| 114 | + } else if ( ! config('skeleton.disable_confirm_email') && ! $user->confirmed) |
|
| 119 | 115 | { |
| 120 | 116 | \ErrorHandler::emailNotConfirmed(); |
| 121 | 117 | } |
@@ -165,8 +161,7 @@ discard block |
||
| 165 | 161 | { |
| 166 | 162 | $user->confirmed = 1; |
| 167 | 163 | $user->save(); |
| 168 | - } |
|
| 169 | - else if ( ! config('skeleton.disable_confirm_email')) |
|
| 164 | + } else if ( ! config('skeleton.disable_confirm_email')) |
|
| 170 | 165 | { |
| 171 | 166 | $this->sendConfirmationEmail($user->email); |
| 172 | 167 | } |
@@ -189,12 +184,10 @@ discard block |
||
| 189 | 184 | if ( ! $this->hasGroup(['Admin'])) |
| 190 | 185 | { |
| 191 | 186 | \ErrorHandler::noPermissions(); |
| 192 | - } |
|
| 193 | - else if (\Auth::id() == $userId) |
|
| 187 | + } else if (\Auth::id() == $userId) |
|
| 194 | 188 | { |
| 195 | 189 | \ErrorHandler::noPermissions(); |
| 196 | - } |
|
| 197 | - else if ($user->groups->pluck('name')->search('Admin', true) !== false) |
|
| 190 | + } else if ($user->groups->pluck('name')->search('Admin', true) !== false) |
|
| 198 | 191 | { |
| 199 | 192 | \ErrorHandler::noPermissions(); |
| 200 | 193 | } |