@@ -30,7 +30,7 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function handle(ScriptWasCreatedEvent $event): void |
| 32 | 32 | { |
| 33 | - $this->service->releaseVersion($event->script,[ |
|
| 33 | + $this->service->releaseVersion($event->script, [ |
|
| 34 | 34 | ScriptRelease::TYPE => "MINOR", |
| 35 | 35 | ScriptRelease::CHANGELOG => "Initial script release" |
| 36 | 36 | ]); |
@@ -38,6 +38,6 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function broadcastOn() |
| 40 | 40 | { |
| 41 | - return []; |
|
| 41 | + return [ ]; |
|
| 42 | 42 | } |
| 43 | 43 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * The listeners that will be fired when the event is dispatched. |
| 13 | 13 | * @var array |
| 14 | 14 | */ |
| 15 | - public $listeners = []; |
|
| 15 | + public $listeners = [ ]; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * @var Script |
@@ -35,6 +35,6 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function broadcastOn() |
| 37 | 37 | { |
| 38 | - return []; |
|
| 38 | + return [ ]; |
|
| 39 | 39 | } |
| 40 | 40 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * The listeners that will be fired when the event is dispatched. |
| 13 | 13 | * @var array |
| 14 | 14 | */ |
| 15 | - public $listeners = []; |
|
| 15 | + public $listeners = [ ]; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * @var Script |
@@ -35,6 +35,6 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function broadcastOn() |
| 37 | 37 | { |
| 38 | - return []; |
|
| 38 | + return [ ]; |
|
| 39 | 39 | } |
| 40 | 40 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * The listeners that will be fired when the event is dispatched. |
| 14 | 14 | * @var array |
| 15 | 15 | */ |
| 16 | - public $listeners = []; |
|
| 16 | + public $listeners = [ ]; |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @var Script |
@@ -36,6 +36,6 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function broadcastOn() |
| 38 | 38 | { |
| 39 | - return []; |
|
| 39 | + return [ ]; |
|
| 40 | 40 | } |
| 41 | 41 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function create(array $data): Script |
| 64 | 64 | { |
| 65 | - $data[Script::AUTHOR_ID] = get_authenticated_user_id(); |
|
| 65 | + $data[ Script::AUTHOR_ID ] = get_authenticated_user_id(); |
|
| 66 | 66 | $script = Script::create($data); |
| 67 | 67 | event(new ScriptWasCreatedEvent($script)); |
| 68 | 68 | return $script; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | $version = new Version($lastVersion); |
| 94 | 94 | |
| 95 | - switch ($data['type']) { |
|
| 95 | + switch ($data[ 'type' ]) { |
|
| 96 | 96 | case 'MAJOR': |
| 97 | 97 | $version->incrementMajor(); |
| 98 | 98 | break; |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | //TODO ADD CONFIG TEMPLATE |
| 110 | 110 | $script->releases()->create([ |
| 111 | 111 | ScriptRelease::VERSION => $version->__toString(), |
| 112 | - ScriptRelease::TYPE => $data['type'], |
|
| 113 | - ScriptRelease::CHANGELOG => $data['changelog'] |
|
| 112 | + ScriptRelease::TYPE => $data[ 'type' ], |
|
| 113 | + ScriptRelease::CHANGELOG => $data[ 'changelog' ] |
|
| 114 | 114 | ]); |
| 115 | 115 | |
| 116 | 116 | return $script; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $review = $script->reviews()->create([ |
| 130 | 130 | ScriptReview::REVIEWER_ID => get_authenticated_user_id(), |
| 131 | 131 | ScriptReview::VERSION => $script->releases->last()->version, |
| 132 | - ScriptReview::MESSAGE => $data['message'] |
|
| 132 | + ScriptReview::MESSAGE => $data[ 'message' ] |
|
| 133 | 133 | ]); |
| 134 | 134 | |
| 135 | 135 | return $review; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $script = $this->resolve($id); |
| 141 | 141 | |
| 142 | - $review = $script->reviews()->withTrashed()->find($data['review_id']); |
|
| 142 | + $review = $script->reviews()->withTrashed()->find($data[ 'review_id' ]); |
|
| 143 | 143 | |
| 144 | 144 | if (!isset($review)) { |
| 145 | 145 | throw new ScriptAlreadyReviewedException(); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | $reply = $review->reply()->create([ |
| 153 | 153 | ScriptReviewReply::REPLIER_ID => get_authenticated_user_id(), |
| 154 | - ScriptReviewReply::MESSAGE => $data['message'] |
|
| 154 | + ScriptReviewReply::MESSAGE => $data[ 'message' ] |
|
| 155 | 155 | ]); |
| 156 | 156 | |
| 157 | 157 | return $reply; |
@@ -160,13 +160,13 @@ discard block |
||
| 160 | 160 | public function grantUserExclusivity($id, array $data): ScriptExclusivity |
| 161 | 161 | { |
| 162 | 162 | $script = $this->resolve($id); |
| 163 | - if ($script->exclusivity()->where(ScriptExclusivity::USER_ID, $data['user_id'] ?? null)->first() !== null) { |
|
| 163 | + if ($script->exclusivity()->where(ScriptExclusivity::USER_ID, $data[ 'user_id' ] ?? null)->first() !== null) { |
|
| 164 | 164 | throw new UserAlreadyHasExclusivityException(); |
| 165 | 165 | } |
| 166 | 166 | $exclusivity = $script->exclusivity()->create([ |
| 167 | - ScriptExclusivity::USER_ID => $data['user_id'], |
|
| 168 | - ScriptExclusivity::BASE_PRICE => $data['base_price'] ?? 0, |
|
| 169 | - ScriptExclusivity::RECURRING_PRICE => $data['recurring_price'] ?? 0 |
|
| 167 | + ScriptExclusivity::USER_ID => $data[ 'user_id' ], |
|
| 168 | + ScriptExclusivity::BASE_PRICE => $data[ 'base_price' ] ?? 0, |
|
| 169 | + ScriptExclusivity::RECURRING_PRICE => $data[ 'recurring_price' ] ?? 0 |
|
| 170 | 170 | ]); |
| 171 | 171 | |
| 172 | 172 | return $exclusivity; |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | public function updateUserExclusivity($id, array $data): ScriptExclusivity |
| 186 | 186 | { |
| 187 | 187 | $script = $this->resolve($id); |
| 188 | - if (($exclusivity = $script->exclusivity()->where(ScriptExclusivity::USER_ID, $data['user_id'] ?? null)->first()) === null) { |
|
| 188 | + if (($exclusivity = $script->exclusivity()->where(ScriptExclusivity::USER_ID, $data[ 'user_id' ] ?? null)->first()) === null) { |
|
| 189 | 189 | throw new UserDoesNotHaveExclusivityException(); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | $exclusivity->update([ |
| 193 | - ScriptExclusivity::BASE_PRICE => $data['base_price'] ?? 0, |
|
| 194 | - ScriptExclusivity::RECURRING_PRICE => $data['recurring_price'] ?? 0 |
|
| 193 | + ScriptExclusivity::BASE_PRICE => $data[ 'base_price' ] ?? 0, |
|
| 194 | + ScriptExclusivity::RECURRING_PRICE => $data[ 'recurring_price' ] ?? 0 |
|
| 195 | 195 | ]); |
| 196 | 196 | |
| 197 | 197 | return $exclusivity; |
@@ -76,8 +76,9 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | $script = $this->resolve($id); |
| 78 | 78 | $deleted = $script->delete(); |
| 79 | - if ($deleted) |
|
| 80 | - event(new ScriptWasDeletedEvent($script)); |
|
| 79 | + if ($deleted) { |
|
| 80 | + event(new ScriptWasDeletedEvent($script)); |
|
| 81 | + } |
|
| 81 | 82 | return $deleted; |
| 82 | 83 | } |
| 83 | 84 | |
@@ -85,10 +86,11 @@ discard block |
||
| 85 | 86 | { |
| 86 | 87 | $script = $this->resolve($id); |
| 87 | 88 | $releases = $script->releases()->get(); |
| 88 | - if ($releases->isEmpty()) |
|
| 89 | - $lastVersion = "0.0.0"; |
|
| 90 | - else |
|
| 91 | - $lastVersion = $releases->last()->version; |
|
| 89 | + if ($releases->isEmpty()) { |
|
| 90 | + $lastVersion = "0.0.0"; |
|
| 91 | + } else { |
|
| 92 | + $lastVersion = $releases->last()->version; |
|
| 93 | + } |
|
| 92 | 94 | |
| 93 | 95 | $version = new Version($lastVersion); |
| 94 | 96 | |
@@ -14,11 +14,11 @@ |
||
| 14 | 14 | use Modules\Authorization\Entities\Permission; |
| 15 | 15 | use Modules\Script\Permissions\ScriptPermission; |
| 16 | 16 | |
| 17 | -Route::get('/', 'ScriptController@index')->middleware(['permission:'.ScriptPermission::INDEX_SCRIPT]); |
|
| 18 | -Route::get('/{id}', 'ScriptController@show')->middleware(['permission:'.ScriptPermission::SHOW_SCRIPT]); |
|
| 19 | -Route::post('/', 'ScriptController@store')->middleware(['permission:'.ScriptPermission::CREATE_SCRIPT]); |
|
| 20 | -Route::patch('/{id}', 'ScriptController@update')->middleware(['permission:'.ScriptPermission::UPDATE_SCRIPT]); |
|
| 21 | -Route::delete('/{id}', 'ScriptController@destroy')->middleware(['permission:'.ScriptPermission::DELETE_SCRIPT]); |
|
| 17 | +Route::get('/', 'ScriptController@index')->middleware([ 'permission:'.ScriptPermission::INDEX_SCRIPT ]); |
|
| 18 | +Route::get('/{id}', 'ScriptController@show')->middleware([ 'permission:'.ScriptPermission::SHOW_SCRIPT ]); |
|
| 19 | +Route::post('/', 'ScriptController@store')->middleware([ 'permission:'.ScriptPermission::CREATE_SCRIPT ]); |
|
| 20 | +Route::patch('/{id}', 'ScriptController@update')->middleware([ 'permission:'.ScriptPermission::UPDATE_SCRIPT ]); |
|
| 21 | +Route::delete('/{id}', 'ScriptController@destroy')->middleware([ 'permission:'.ScriptPermission::DELETE_SCRIPT ]); |
|
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | * @param FindScriptRequest $request |
| 70 | 70 | * @param $id |
| 71 | 71 | */ |
| 72 | - public function show(FindScriptRequest $request ,$id) |
|
| 72 | + public function show(FindScriptRequest $request, $id) |
|
| 73 | 73 | { |
| 74 | 74 | $script = $this->service->resolve($id); |
| 75 | 75 | |
@@ -35,12 +35,12 @@ |
||
| 35 | 35 | /** |
| 36 | 36 | * @var array |
| 37 | 37 | */ |
| 38 | - protected $guarded = []; |
|
| 38 | + protected $guarded = [ ]; |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * @var array |
| 42 | 42 | */ |
| 43 | - protected $casts = []; |
|
| 43 | + protected $casts = [ ]; |
|
| 44 | 44 | |
| 45 | 45 | protected $dates = [ |
| 46 | 46 | 'created_at', |