@@ -5,53 +5,53 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class PushNotificationDeviceObserver { |
| 7 | 7 | |
| 8 | - public function saving($model) |
|
| 9 | - { |
|
| 10 | - // |
|
| 11 | - } |
|
| 12 | - |
|
| 13 | - public function saved($model) |
|
| 14 | - { |
|
| 15 | - // |
|
| 16 | - } |
|
| 17 | - |
|
| 18 | - public function creating($model) |
|
| 19 | - { |
|
| 20 | - // |
|
| 21 | - } |
|
| 22 | - |
|
| 23 | - public function created($model) |
|
| 24 | - { |
|
| 25 | - // |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - public function updating($model) |
|
| 29 | - { |
|
| 30 | - // |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - public function updated($model) |
|
| 34 | - { |
|
| 35 | - // |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - public function deleting($model) |
|
| 39 | - { |
|
| 40 | - // |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - public function deleted($model) |
|
| 44 | - { |
|
| 45 | - // |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - public function restoring($model) |
|
| 49 | - { |
|
| 50 | - // |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - public function restored($model) |
|
| 54 | - { |
|
| 55 | - // |
|
| 56 | - } |
|
| 8 | + public function saving($model) |
|
| 9 | + { |
|
| 10 | + // |
|
| 11 | + } |
|
| 12 | + |
|
| 13 | + public function saved($model) |
|
| 14 | + { |
|
| 15 | + // |
|
| 16 | + } |
|
| 17 | + |
|
| 18 | + public function creating($model) |
|
| 19 | + { |
|
| 20 | + // |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + public function created($model) |
|
| 24 | + { |
|
| 25 | + // |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + public function updating($model) |
|
| 29 | + { |
|
| 30 | + // |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + public function updated($model) |
|
| 34 | + { |
|
| 35 | + // |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + public function deleting($model) |
|
| 39 | + { |
|
| 40 | + // |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + public function deleted($model) |
|
| 44 | + { |
|
| 45 | + // |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + public function restoring($model) |
|
| 49 | + { |
|
| 50 | + // |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + public function restored($model) |
|
| 54 | + { |
|
| 55 | + // |
|
| 56 | + } |
|
| 57 | 57 | } |
| 58 | 58 | \ No newline at end of file |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | if ($this->cacheConfig && $this->cacheConfig == 'cache') |
| 65 | 65 | { |
| 66 | 66 | $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
| 67 | - $cacheKey = $name . $page . \Session::get('locale') . serialize($arguments); |
|
| 67 | + $cacheKey = $name.$page.\Session::get('locale').serialize($arguments); |
|
| 68 | 68 | return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
| 69 | 69 | return call_user_func_array([$this->repo, $name], $arguments); |
| 70 | 70 | }); |
@@ -68,8 +68,7 @@ discard block |
||
| 68 | 68 | return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
| 69 | 69 | return call_user_func_array([$this->repo, $name], $arguments); |
| 70 | 70 | }); |
| 71 | - } |
|
| 72 | - else if ($this->cacheConfig) |
|
| 71 | + } else if ($this->cacheConfig) |
|
| 73 | 72 | { |
| 74 | 73 | $this->cache->tags($this->cacheConfig)->flush(); |
| 75 | 74 | return call_user_func_array([$this->repo, $name], $arguments); |
@@ -93,8 +92,7 @@ discard block |
||
| 93 | 92 | if ($cacheConfig && in_array($name, $cacheConfig['cache'])) |
| 94 | 93 | { |
| 95 | 94 | $this->cacheConfig = 'cache'; |
| 96 | - } |
|
| 97 | - else if ($cacheConfig && isset($cacheConfig['clear'][$name])) |
|
| 95 | + } else if ($cacheConfig && isset($cacheConfig['clear'][$name])) |
|
| 98 | 96 | { |
| 99 | 97 | $this->cacheConfig = $cacheConfig['clear'][$name]; |
| 100 | 98 | } |
@@ -2,117 +2,117 @@ |
||
| 2 | 2 | |
| 3 | 3 | class CachingDecorator |
| 4 | 4 | { |
| 5 | - /** |
|
| 6 | - * The repo implementation. |
|
| 7 | - * |
|
| 8 | - * @var string |
|
| 9 | - */ |
|
| 10 | - public $repo; |
|
| 5 | + /** |
|
| 6 | + * The repo implementation. |
|
| 7 | + * |
|
| 8 | + * @var string |
|
| 9 | + */ |
|
| 10 | + public $repo; |
|
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * The cache implementation. |
|
| 14 | - * |
|
| 15 | - * @var object |
|
| 16 | - */ |
|
| 17 | - protected $cache; |
|
| 12 | + /** |
|
| 13 | + * The cache implementation. |
|
| 14 | + * |
|
| 15 | + * @var object |
|
| 16 | + */ |
|
| 17 | + protected $cache; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * The modelKey implementation. |
|
| 21 | - * |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - public $modelKey; |
|
| 19 | + /** |
|
| 20 | + * The modelKey implementation. |
|
| 21 | + * |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + public $modelKey; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * The model implementation. |
|
| 28 | - * |
|
| 29 | - * @var string |
|
| 30 | - */ |
|
| 31 | - public $model; |
|
| 26 | + /** |
|
| 27 | + * The model implementation. |
|
| 28 | + * |
|
| 29 | + * @var string |
|
| 30 | + */ |
|
| 31 | + public $model; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * The modelClass implementation. |
|
| 35 | - * |
|
| 36 | - * @var string |
|
| 37 | - */ |
|
| 38 | - public $modelClass; |
|
| 33 | + /** |
|
| 34 | + * The modelClass implementation. |
|
| 35 | + * |
|
| 36 | + * @var string |
|
| 37 | + */ |
|
| 38 | + public $modelClass; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * The cacheConfig implementation. |
|
| 42 | - * |
|
| 43 | - * @var array |
|
| 44 | - */ |
|
| 45 | - public $cacheConfig; |
|
| 40 | + /** |
|
| 41 | + * The cacheConfig implementation. |
|
| 42 | + * |
|
| 43 | + * @var array |
|
| 44 | + */ |
|
| 45 | + public $cacheConfig; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * The cacheTag implementation. |
|
| 49 | - * |
|
| 50 | - * @var string |
|
| 51 | - */ |
|
| 52 | - public $cacheTag; |
|
| 47 | + /** |
|
| 48 | + * The cacheTag implementation. |
|
| 49 | + * |
|
| 50 | + * @var string |
|
| 51 | + */ |
|
| 52 | + public $cacheTag; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Create new CachingDecorator instance. |
|
| 56 | - */ |
|
| 57 | - public function __construct($repo, $cache) |
|
| 58 | - { |
|
| 59 | - $this->repo = $repo; |
|
| 60 | - $this->cache = $cache; |
|
| 61 | - $this->model = $this->repo->model; |
|
| 62 | - $this->modelClass = get_class($this->model); |
|
| 63 | - $repoClass = explode('\\', get_class($this->repo)); |
|
| 64 | - $repoName = end($repoClass); |
|
| 65 | - $this->cacheTag = str_plural(lcfirst(substr($repoName, 0, strpos($repoName, 'Repository')))); |
|
| 66 | - } |
|
| 54 | + /** |
|
| 55 | + * Create new CachingDecorator instance. |
|
| 56 | + */ |
|
| 57 | + public function __construct($repo, $cache) |
|
| 58 | + { |
|
| 59 | + $this->repo = $repo; |
|
| 60 | + $this->cache = $cache; |
|
| 61 | + $this->model = $this->repo->model; |
|
| 62 | + $this->modelClass = get_class($this->model); |
|
| 63 | + $repoClass = explode('\\', get_class($this->repo)); |
|
| 64 | + $repoName = end($repoClass); |
|
| 65 | + $this->cacheTag = str_plural(lcfirst(substr($repoName, 0, strpos($repoName, 'Repository')))); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Handle the cache mechanism for the called method |
|
| 70 | - * based the configurations. |
|
| 71 | - * |
|
| 72 | - * @param string $name the called method name |
|
| 73 | - * @param array $arguments the method arguments |
|
| 74 | - * @return object |
|
| 75 | - */ |
|
| 76 | - public function __call($name, $arguments) |
|
| 77 | - { |
|
| 78 | - $this->setCacheConfig($name); |
|
| 68 | + /** |
|
| 69 | + * Handle the cache mechanism for the called method |
|
| 70 | + * based the configurations. |
|
| 71 | + * |
|
| 72 | + * @param string $name the called method name |
|
| 73 | + * @param array $arguments the method arguments |
|
| 74 | + * @return object |
|
| 75 | + */ |
|
| 76 | + public function __call($name, $arguments) |
|
| 77 | + { |
|
| 78 | + $this->setCacheConfig($name); |
|
| 79 | 79 | |
| 80 | - if ($this->cacheConfig && $this->cacheConfig == 'cache') |
|
| 81 | - { |
|
| 82 | - $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
|
| 83 | - $cacheKey = $name . $page . \Session::get('locale') . serialize($arguments); |
|
| 84 | - return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
|
| 85 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
| 86 | - }); |
|
| 87 | - } |
|
| 88 | - else if ($this->cacheConfig) |
|
| 89 | - { |
|
| 90 | - $this->cache->tags($this->cacheConfig)->flush(); |
|
| 91 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
| 92 | - } |
|
| 80 | + if ($this->cacheConfig && $this->cacheConfig == 'cache') |
|
| 81 | + { |
|
| 82 | + $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
|
| 83 | + $cacheKey = $name . $page . \Session::get('locale') . serialize($arguments); |
|
| 84 | + return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
|
| 85 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
| 86 | + }); |
|
| 87 | + } |
|
| 88 | + else if ($this->cacheConfig) |
|
| 89 | + { |
|
| 90 | + $this->cache->tags($this->cacheConfig)->flush(); |
|
| 91 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
| 95 | - } |
|
| 94 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Set cache config based on the called method. |
|
| 99 | - * |
|
| 100 | - * @param string $name |
|
| 101 | - * @return void |
|
| 102 | - */ |
|
| 103 | - private function setCacheConfig($name) |
|
| 104 | - { |
|
| 105 | - $config = \CoreConfig::getConfig(); |
|
| 106 | - $cacheConfig = array_key_exists($this->cacheTag, $config['cacheConfig']) ? $config['cacheConfig'][$this->cacheTag] : false; |
|
| 107 | - $this->cacheConfig = false; |
|
| 97 | + /** |
|
| 98 | + * Set cache config based on the called method. |
|
| 99 | + * |
|
| 100 | + * @param string $name |
|
| 101 | + * @return void |
|
| 102 | + */ |
|
| 103 | + private function setCacheConfig($name) |
|
| 104 | + { |
|
| 105 | + $config = \CoreConfig::getConfig(); |
|
| 106 | + $cacheConfig = array_key_exists($this->cacheTag, $config['cacheConfig']) ? $config['cacheConfig'][$this->cacheTag] : false; |
|
| 107 | + $this->cacheConfig = false; |
|
| 108 | 108 | |
| 109 | - if ($cacheConfig && in_array($name, $cacheConfig['cache'])) |
|
| 110 | - { |
|
| 111 | - $this->cacheConfig = 'cache'; |
|
| 112 | - } |
|
| 113 | - else if ($cacheConfig && isset($cacheConfig['clear'][$name])) |
|
| 114 | - { |
|
| 115 | - $this->cacheConfig = $cacheConfig['clear'][$name]; |
|
| 116 | - } |
|
| 117 | - } |
|
| 109 | + if ($cacheConfig && in_array($name, $cacheConfig['cache'])) |
|
| 110 | + { |
|
| 111 | + $this->cacheConfig = 'cache'; |
|
| 112 | + } |
|
| 113 | + else if ($cacheConfig && isset($cacheConfig['clear'][$name])) |
|
| 114 | + { |
|
| 115 | + $this->cacheConfig = $cacheConfig['clear'][$name]; |
|
| 116 | + } |
|
| 117 | + } |
|
| 118 | 118 | } |
| 119 | 119 | \ No newline at end of file |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | $factory->define(App\Modules\V1\Core\Settings::class, function (Faker\Generator $faker) { |
| 4 | - return [ |
|
| 4 | + return [ |
|
| 5 | 5 | 'name' => $faker->randomElement(['Company Name', 'Title', 'Header Image']), |
| 6 | 6 | 'value' => $faker->word(), |
| 7 | 7 | 'key' => $faker->word(), |
| 8 | 8 | 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
| 9 | 9 | 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
| 10 | - ]; |
|
| 10 | + ]; |
|
| 11 | 11 | }); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\V1\Core\Settings::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\V1\Core\Settings::class, function(Faker\Generator $faker) { |
|
| 4 | 4 | return [ |
| 5 | 5 | 'name' => $faker->randomElement(['Company Name', 'Title', 'Header Image']), |
| 6 | 6 | 'value' => $faker->word(), |
@@ -5,68 +5,68 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class SettingsObserver { |
| 7 | 7 | |
| 8 | - public function saving($model) |
|
| 9 | - { |
|
| 10 | - // |
|
| 11 | - } |
|
| 8 | + public function saving($model) |
|
| 9 | + { |
|
| 10 | + // |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public function saved($model) |
|
| 14 | - { |
|
| 15 | - // |
|
| 16 | - } |
|
| 13 | + public function saved($model) |
|
| 14 | + { |
|
| 15 | + // |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Prevent the creating of the settings. |
|
| 20 | - * |
|
| 21 | - * @param object $model the model beign created. |
|
| 22 | - * @return void |
|
| 23 | - */ |
|
| 24 | - public function creating($model) |
|
| 25 | - { |
|
| 26 | - \ErrorHandler::cannotCreateSetting(); |
|
| 27 | - } |
|
| 18 | + /** |
|
| 19 | + * Prevent the creating of the settings. |
|
| 20 | + * |
|
| 21 | + * @param object $model the model beign created. |
|
| 22 | + * @return void |
|
| 23 | + */ |
|
| 24 | + public function creating($model) |
|
| 25 | + { |
|
| 26 | + \ErrorHandler::cannotCreateSetting(); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - public function created($model) |
|
| 30 | - { |
|
| 31 | - // |
|
| 32 | - } |
|
| 29 | + public function created($model) |
|
| 30 | + { |
|
| 31 | + // |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Prevent updating of the setting key. |
|
| 36 | - * |
|
| 37 | - * @param object $model the model beign updated. |
|
| 38 | - * @return void |
|
| 39 | - */ |
|
| 40 | - public function updating($model) |
|
| 41 | - { |
|
| 42 | - if ($model->getOriginal('key') !== $model->key) |
|
| 43 | - { |
|
| 44 | - \ErrorHandler::cannotUpdateSettingKey(); |
|
| 45 | - } |
|
| 46 | - } |
|
| 34 | + /** |
|
| 35 | + * Prevent updating of the setting key. |
|
| 36 | + * |
|
| 37 | + * @param object $model the model beign updated. |
|
| 38 | + * @return void |
|
| 39 | + */ |
|
| 40 | + public function updating($model) |
|
| 41 | + { |
|
| 42 | + if ($model->getOriginal('key') !== $model->key) |
|
| 43 | + { |
|
| 44 | + \ErrorHandler::cannotUpdateSettingKey(); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - public function updated($model) |
|
| 49 | - { |
|
| 50 | - // |
|
| 51 | - } |
|
| 48 | + public function updated($model) |
|
| 49 | + { |
|
| 50 | + // |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - public function deleting($model) |
|
| 54 | - { |
|
| 55 | - // |
|
| 56 | - } |
|
| 53 | + public function deleting($model) |
|
| 54 | + { |
|
| 55 | + // |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - public function deleted($model) |
|
| 59 | - { |
|
| 60 | - // |
|
| 61 | - } |
|
| 58 | + public function deleted($model) |
|
| 59 | + { |
|
| 60 | + // |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - public function restoring($model) |
|
| 64 | - { |
|
| 65 | - // |
|
| 66 | - } |
|
| 63 | + public function restoring($model) |
|
| 64 | + { |
|
| 65 | + // |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - public function restored($model) |
|
| 69 | - { |
|
| 70 | - // |
|
| 71 | - } |
|
| 68 | + public function restored($model) |
|
| 69 | + { |
|
| 70 | + // |
|
| 71 | + } |
|
| 72 | 72 | } |
| 73 | 73 | \ No newline at end of file |
@@ -3,10 +3,10 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | class CoreConfig |
| 5 | 5 | { |
| 6 | - public function getConfig() |
|
| 7 | - { |
|
| 8 | - return [ |
|
| 9 | - 'resetLink' => '{{link_here}}', |
|
| 6 | + public function getConfig() |
|
| 7 | + { |
|
| 8 | + return [ |
|
| 9 | + 'resetLink' => '{{link_here}}', |
|
| 10 | 10 | /** |
| 11 | 11 | * Specify what relations should be used for every model. |
| 12 | 12 | */ |
@@ -180,5 +180,5 @@ discard block |
||
| 180 | 180 | ] |
| 181 | 181 | ] |
| 182 | 182 | ]; |
| 183 | - } |
|
| 183 | + } |
|
| 184 | 184 | } |
| 185 | 185 | \ No newline at end of file |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\V1\Notifications\PushNotificationDevice::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\V1\Notifications\PushNotificationDevice::class, function(Faker\Generator $faker) { |
|
| 4 | 4 | return [ |
| 5 | 5 | 'device_token' => $faker->sha1(), |
| 6 | 6 | 'user_id' => $faker->randomDigitNotNull(), |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | $factory->define(App\Modules\V1\Notifications\PushNotificationDevice::class, function (Faker\Generator $faker) { |
| 4 | - return [ |
|
| 4 | + return [ |
|
| 5 | 5 | 'device_token' => $faker->sha1(), |
| 6 | 6 | 'user_id' => $faker->randomDigitNotNull(), |
| 7 | 7 | 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
| 8 | 8 | 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
| 9 | - ]; |
|
| 9 | + ]; |
|
| 10 | 10 | }); |
| 11 | 11 | \ No newline at end of file |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | $table->unique(array('device_token', 'user_id')); |
| 21 | 21 | $table->softDeletes(); |
| 22 | 22 | $table->timestamps(); |
| 23 | - }); |
|
| 23 | + }); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -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'); |
@@ -6,33 +6,33 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateJobsTable extends Migration |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the migrations. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function up() |
|
| 15 | - { |
|
| 16 | - Schema::create('jobs', function (Blueprint $table) { |
|
| 17 | - $table->bigIncrements('id'); |
|
| 18 | - $table->string('queue'); |
|
| 19 | - $table->longText('payload'); |
|
| 20 | - $table->tinyInteger('attempts')->unsigned(); |
|
| 21 | - $table->unsignedInteger('reserved_at')->nullable(); |
|
| 22 | - $table->unsignedInteger('available_at'); |
|
| 23 | - $table->unsignedInteger('created_at'); |
|
| 9 | + /** |
|
| 10 | + * Run the migrations. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function up() |
|
| 15 | + { |
|
| 16 | + Schema::create('jobs', function (Blueprint $table) { |
|
| 17 | + $table->bigIncrements('id'); |
|
| 18 | + $table->string('queue'); |
|
| 19 | + $table->longText('payload'); |
|
| 20 | + $table->tinyInteger('attempts')->unsigned(); |
|
| 21 | + $table->unsignedInteger('reserved_at')->nullable(); |
|
| 22 | + $table->unsignedInteger('available_at'); |
|
| 23 | + $table->unsignedInteger('created_at'); |
|
| 24 | 24 | |
| 25 | - $table->index(['queue', 'reserved_at']); |
|
| 26 | - }); |
|
| 27 | - } |
|
| 25 | + $table->index(['queue', 'reserved_at']); |
|
| 26 | + }); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Reverse the migrations. |
|
| 31 | - * |
|
| 32 | - * @return void |
|
| 33 | - */ |
|
| 34 | - public function down() |
|
| 35 | - { |
|
| 36 | - Schema::dropIfExists('jobs'); |
|
| 37 | - } |
|
| 29 | + /** |
|
| 30 | + * Reverse the migrations. |
|
| 31 | + * |
|
| 32 | + * @return void |
|
| 33 | + */ |
|
| 34 | + public function down() |
|
| 35 | + { |
|
| 36 | + Schema::dropIfExists('jobs'); |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('jobs', function (Blueprint $table) { |
|
| 16 | + Schema::create('jobs', function(Blueprint $table) { |
|
| 17 | 17 | $table->bigIncrements('id'); |
| 18 | 18 | $table->string('queue'); |
| 19 | 19 | $table->longText('payload'); |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | use App\User; |
| 4 | 4 | use Illuminate\Database\Eloquent\SoftDeletes; |
| 5 | -use Illuminate\Notifications\Notifiable; |
|
| 6 | 5 | use Laravel\Passport\HasApiTokens; |
| 7 | 6 | |
| 8 | 7 | class AclUser extends User { |
@@ -67,8 +67,7 @@ |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $tokens[] = $device->device_token; |
| 70 | - } |
|
| 71 | - catch (\Exception $e) |
|
| 70 | + } catch (\Exception $e) |
|
| 72 | 71 | { |
| 73 | 72 | $device->forceDelete(); |
| 74 | 73 | } |
@@ -7,89 +7,89 @@ |
||
| 7 | 7 | |
| 8 | 8 | class AclUser extends User { |
| 9 | 9 | |
| 10 | - use SoftDeletes, HasApiTokens; |
|
| 11 | - protected $table = 'users'; |
|
| 12 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 13 | - protected $hidden = ['password', 'remember_token','deleted_at', 'two_factor_code']; |
|
| 14 | - protected $guarded = ['id']; |
|
| 15 | - protected $fillable = ['name', 'email', 'password']; |
|
| 16 | - public $searchable = ['name', 'email']; |
|
| 10 | + use SoftDeletes, HasApiTokens; |
|
| 11 | + protected $table = 'users'; |
|
| 12 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 13 | + protected $hidden = ['password', 'remember_token','deleted_at', 'two_factor_code']; |
|
| 14 | + protected $guarded = ['id']; |
|
| 15 | + protected $fillable = ['name', 'email', 'password']; |
|
| 16 | + public $searchable = ['name', 'email']; |
|
| 17 | 17 | |
| 18 | - public function getCreatedAtAttribute($value) |
|
| 19 | - { |
|
| 20 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 21 | - } |
|
| 18 | + public function getCreatedAtAttribute($value) |
|
| 19 | + { |
|
| 20 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function getUpdatedAtAttribute($value) |
|
| 24 | - { |
|
| 25 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 26 | - } |
|
| 23 | + public function getUpdatedAtAttribute($value) |
|
| 24 | + { |
|
| 25 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public function getDeletedAtAttribute($value) |
|
| 29 | - { |
|
| 30 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 31 | - } |
|
| 28 | + public function getDeletedAtAttribute($value) |
|
| 29 | + { |
|
| 30 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Encrypt the password attribute before |
|
| 35 | - * saving it in the storage. |
|
| 36 | - * |
|
| 37 | - * @param string $value |
|
| 38 | - */ |
|
| 39 | - public function setPasswordAttribute($value) |
|
| 40 | - { |
|
| 41 | - $this->attributes['password'] = bcrypt($value); |
|
| 42 | - } |
|
| 33 | + /** |
|
| 34 | + * Encrypt the password attribute before |
|
| 35 | + * saving it in the storage. |
|
| 36 | + * |
|
| 37 | + * @param string $value |
|
| 38 | + */ |
|
| 39 | + public function setPasswordAttribute($value) |
|
| 40 | + { |
|
| 41 | + $this->attributes['password'] = bcrypt($value); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - public function groups() |
|
| 45 | - { |
|
| 46 | - return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
| 47 | - } |
|
| 44 | + public function groups() |
|
| 45 | + { |
|
| 46 | + return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Return fcm device tokens related to the user. |
|
| 51 | - * @return array |
|
| 52 | - */ |
|
| 53 | - public function routeNotificationForFCM() |
|
| 54 | - { |
|
| 55 | - $devices = \Core::pushNotificationsDevices()->findBy(['user_id' => $this->id]); |
|
| 56 | - $tokens = []; |
|
| 49 | + /** |
|
| 50 | + * Return fcm device tokens related to the user. |
|
| 51 | + * @return array |
|
| 52 | + */ |
|
| 53 | + public function routeNotificationForFCM() |
|
| 54 | + { |
|
| 55 | + $devices = \Core::pushNotificationsDevices()->findBy(['user_id' => $this->id]); |
|
| 56 | + $tokens = []; |
|
| 57 | 57 | |
| 58 | - foreach ($devices as $device) |
|
| 59 | - { |
|
| 60 | - $accessToken = decrypt($device->access_token); |
|
| 58 | + foreach ($devices as $device) |
|
| 59 | + { |
|
| 60 | + $accessToken = decrypt($device->access_token); |
|
| 61 | 61 | |
| 62 | - try |
|
| 63 | - { |
|
| 64 | - if (\Core::users()->accessTokenExpiredOrRevoked($accessToken)) |
|
| 65 | - { |
|
| 66 | - continue; |
|
| 67 | - } |
|
| 62 | + try |
|
| 63 | + { |
|
| 64 | + if (\Core::users()->accessTokenExpiredOrRevoked($accessToken)) |
|
| 65 | + { |
|
| 66 | + continue; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - $tokens[] = $device->device_token; |
|
| 70 | - } |
|
| 71 | - catch (\Exception $e) |
|
| 72 | - { |
|
| 73 | - $device->forceDelete(); |
|
| 74 | - } |
|
| 75 | - } |
|
| 69 | + $tokens[] = $device->device_token; |
|
| 70 | + } |
|
| 71 | + catch (\Exception $e) |
|
| 72 | + { |
|
| 73 | + $device->forceDelete(); |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - return $tokens; |
|
| 78 | - } |
|
| 77 | + return $tokens; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * The channels the user receives notification broadcasts on. |
|
| 82 | - * |
|
| 83 | - * @return string |
|
| 84 | - */ |
|
| 85 | - public function receivesBroadcastNotificationsOn() |
|
| 86 | - { |
|
| 87 | - return 'users.' . $this->id; |
|
| 88 | - } |
|
| 80 | + /** |
|
| 81 | + * The channels the user receives notification broadcasts on. |
|
| 82 | + * |
|
| 83 | + * @return string |
|
| 84 | + */ |
|
| 85 | + public function receivesBroadcastNotificationsOn() |
|
| 86 | + { |
|
| 87 | + return 'users.' . $this->id; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - public static function boot() |
|
| 91 | - { |
|
| 92 | - parent::boot(); |
|
| 93 | - parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\AclUserObserver')); |
|
| 94 | - } |
|
| 90 | + public static function boot() |
|
| 91 | + { |
|
| 92 | + parent::boot(); |
|
| 93 | + parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\AclUserObserver')); |
|
| 94 | + } |
|
| 95 | 95 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | use SoftDeletes, HasApiTokens; |
| 11 | 11 | protected $table = 'users'; |
| 12 | 12 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
| 13 | - protected $hidden = ['password', 'remember_token','deleted_at', 'two_factor_code']; |
|
| 13 | + protected $hidden = ['password', 'remember_token', 'deleted_at', 'two_factor_code']; |
|
| 14 | 14 | protected $guarded = ['id']; |
| 15 | 15 | protected $fillable = ['name', 'email', 'password']; |
| 16 | 16 | public $searchable = ['name', 'email']; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public function groups() |
| 45 | 45 | { |
| 46 | - return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
| 46 | + return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup', 'users_groups', 'user_id', 'group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function receivesBroadcastNotificationsOn() |
| 86 | 86 | { |
| 87 | - return 'users.' . $this->id; |
|
| 87 | + return 'users.'.$this->id; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | public static function boot() |