@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) { |
|
| 4 | - $_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"]; |
|
| 3 | +if (isset($_SERVER[ "HTTP_CF_CONNECTING_IP" ])) { |
|
| 4 | + $_SERVER[ 'REMOTE_ADDR' ] = $_SERVER[ "HTTP_CF_CONNECTING_IP" ]; |
|
| 5 | 5 | } |
| 6 | 6 | \ No newline at end of file |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | if (empty($array)) |
| 39 | 39 | return null; |
| 40 | 40 | $randomIndex = random_int(0, sizeof($array) - 1); |
| 41 | - return $array[$randomIndex]; |
|
| 41 | + return $array[ $randomIndex ]; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | if (!function_exists('createArrayFromFactory')) { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $traits = array_flip(class_uses_recursive($class)); |
| 85 | 85 | |
| 86 | - return isset($traits[$trait]); |
|
| 86 | + return isset($traits[ $trait ]); |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
@@ -26,8 +26,9 @@ discard block |
||
| 26 | 26 | if (!function_exists('getShortClassName')) { |
| 27 | 27 | function getShortClassName($class) |
| 28 | 28 | { |
| 29 | - if (!is_string($class)) |
|
| 30 | - $class = get_class($class); |
|
| 29 | + if (!is_string($class)) { |
|
| 30 | + $class = get_class($class); |
|
| 31 | + } |
|
| 31 | 32 | return substr(strrchr($class, '\\'), 1); |
| 32 | 33 | } |
| 33 | 34 | } |
@@ -35,8 +36,9 @@ discard block |
||
| 35 | 36 | if (!function_exists('getRandomArrayElement')) { |
| 36 | 37 | function getRandomArrayElement(array $array) |
| 37 | 38 | { |
| 38 | - if (empty($array)) |
|
| 39 | - return null; |
|
| 39 | + if (empty($array)) { |
|
| 40 | + return null; |
|
| 41 | + } |
|
| 40 | 42 | $randomIndex = random_int(0, sizeof($array) - 1); |
| 41 | 43 | return $array[$randomIndex]; |
| 42 | 44 | } |
@@ -44,13 +46,15 @@ discard block |
||
| 44 | 46 | if (!function_exists('createArrayFromFactory')) { |
| 45 | 47 | function createArrayFromFactory(string $modelClass, $amount = 1, ?string $state = null) |
| 46 | 48 | { |
| 47 | - if ($amount < 1) |
|
| 48 | - return false; |
|
| 49 | + if ($amount < 1) { |
|
| 50 | + return false; |
|
| 51 | + } |
|
| 49 | 52 | |
| 50 | 53 | $factory = factory($modelClass, $amount); |
| 51 | 54 | |
| 52 | - if ($state !== null) |
|
| 53 | - $factory->state($state); |
|
| 55 | + if ($state !== null) { |
|
| 56 | + $factory->state($state); |
|
| 57 | + } |
|
| 54 | 58 | |
| 55 | 59 | return $factory->raw(); |
| 56 | 60 | } |
@@ -61,8 +65,9 @@ discard block |
||
| 61 | 65 | { |
| 62 | 66 | $factory = factory($modelClass); |
| 63 | 67 | |
| 64 | - if ($state !== null) |
|
| 65 | - $factory->state($state); |
|
| 68 | + if ($state !== null) { |
|
| 69 | + $factory->state($state); |
|
| 70 | + } |
|
| 66 | 71 | |
| 67 | 72 | return $factory->raw(); |
| 68 | 73 | } |
@@ -78,8 +83,9 @@ discard block |
||
| 78 | 83 | if (!function_exists('classUsesTrait')) { |
| 79 | 84 | function classUsesTrait($class, string $trait) |
| 80 | 85 | { |
| 81 | - if (!is_string($class)) |
|
| 82 | - $class = get_class($class); |
|
| 86 | + if (!is_string($class)) { |
|
| 87 | + $class = get_class($class); |
|
| 88 | + } |
|
| 83 | 89 | |
| 84 | 90 | $traits = array_flip(class_uses_recursive($class)); |
| 85 | 91 | |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | $this->artisan('migrate:fresh'); |
| 24 | 24 | $this->artisan('db:seed'); |
| 25 | 25 | |
| 26 | - $this->beforeApplicationDestroyed(function () { |
|
| 26 | + $this->beforeApplicationDestroyed(function() { |
|
| 27 | 27 | $this->artisan('migrate:rollback'); |
| 28 | 28 | RefreshDatabaseState::$migrated = false; |
| 29 | 29 | }); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | { |
| 16 | 16 | public function ownerId() |
| 17 | 17 | { |
| 18 | - $ownerAttributeName = strtolower(getShortClassName($this->ownedBy())) . '_id'; |
|
| 18 | + $ownerAttributeName = strtolower(getShortClassName($this->ownedBy())).'_id'; |
|
| 19 | 19 | return $this->$ownerAttributeName; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function created($model) |
| 21 | 21 | { |
| 22 | - $model->relations = []; |
|
| 22 | + $model->relations = [ ]; |
|
| 23 | 23 | ModelCache::store($model); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -13,6 +13,6 @@ |
||
| 13 | 13 | | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -Artisan::command('inspire', function () { |
|
| 16 | +Artisan::command('inspire', function() { |
|
| 17 | 17 | $this->comment(Inspiring::quote()); |
| 18 | 18 | })->describe('Display an inspiring quote'); |
@@ -11,6 +11,6 @@ |
||
| 11 | 11 | | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -Broadcast::channel('App.User.{id}', function ($user, $id) { |
|
| 15 | - return (int)$user->id === (int)$id; |
|
| 14 | +Broadcast::channel('App.User.{id}', function($user, $id) { |
|
| 15 | + return (int) $user->id === (int) $id; |
|
| 16 | 16 | }); |