@@ -3,7 +3,7 @@ |
||
3 | 3 | include __DIR__.'/vendor/autoload.php'; |
4 | 4 | |
5 | 5 | $capsule = new \Illuminate\Database\Capsule\Manager; |
6 | -$capsule->addConnection([ 'driver' => 'sqlite', 'database' => ':memory:', 'prefix' => 'prfx_' ]); |
|
6 | +$capsule->addConnection(['driver' => 'sqlite', 'database' => ':memory:', 'prefix' => 'prfx_']); |
|
7 | 7 | $capsule->setEventDispatcher(new \Illuminate\Events\Dispatcher); |
8 | 8 | $capsule->bootEloquent(); |
9 | 9 | $capsule->setAsGlobal(); |
@@ -21,16 +21,16 @@ discard block |
||
21 | 21 | */ |
22 | 22 | protected static function bootCascadedSoftDeletes() |
23 | 23 | { |
24 | - static::deleted(function ($model) { |
|
24 | + static::deleted(function($model) { |
|
25 | 25 | $model->deleteCascadedSoftDeletes(); |
26 | 26 | }); |
27 | 27 | |
28 | 28 | if (static::instanceUsesSoftDelete()) { |
29 | - static::restoring(function ($model) { |
|
29 | + static::restoring(function($model) { |
|
30 | 30 | static::$instanceDeletedAt = $model->{$model->getDeletedAtColumn()}; |
31 | 31 | }); |
32 | 32 | |
33 | - static::restored(function ($model) { |
|
33 | + static::restored(function($model) { |
|
34 | 34 | $model->restoreCascadedSoftDeleted(); |
35 | 35 | }); |
36 | 36 | } |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | } else { |
51 | 51 | // @codeCoverageIgnoreStart |
52 | 52 | Str::startsWith(app()->version(), '7') ? |
53 | - CascadeSoftDeletes::dispatchNow($this, 'delete', null) : |
|
54 | - CascadeSoftDeletes::dispatchSync($this, 'delete', null); |
|
53 | + CascadeSoftDeletes::dispatchNow($this, 'delete', null) : CascadeSoftDeletes::dispatchSync($this, 'delete', null); |
|
55 | 54 | // @codeCoverageIgnoreEnd |
56 | 55 | } |
57 | 56 | } |
@@ -66,8 +65,7 @@ discard block |
||
66 | 65 | } else { |
67 | 66 | // @codeCoverageIgnoreStart |
68 | 67 | Str::startsWith(app()->version(), '7') ? |
69 | - CascadeSoftDeletes::dispatchNow($this, 'restore', static::$instanceDeletedAt) : |
|
70 | - CascadeSoftDeletes::dispatchSync($this, 'restore', static::$instanceDeletedAt); |
|
68 | + CascadeSoftDeletes::dispatchNow($this, 'restore', static::$instanceDeletedAt) : CascadeSoftDeletes::dispatchSync($this, 'restore', static::$instanceDeletedAt); |
|
71 | 69 | // @codeCoverageIgnoreEnd |
72 | 70 | } |
73 | 71 | // CascadeSoftDeletes::dispatch($this, 'restore', static::$instanceDeletedAt); |
@@ -88,14 +86,14 @@ discard block |
||
88 | 86 | throw new RuntimeException('neither getCascadedSoftDeletes function or cascaded_soft_deletes property exists!'); |
89 | 87 | } |
90 | 88 | |
91 | - $relations->each(function ($item, $key) use ($action, $instanceDeletedAt) { |
|
89 | + $relations->each(function($item, $key) use ($action, $instanceDeletedAt) { |
|
92 | 90 | $relation = $key; |
93 | 91 | if (is_numeric($key)) { |
94 | 92 | $relation = $item; |
95 | 93 | } |
96 | 94 | |
97 | 95 | if (!is_callable($item) && !$this->relationUsesSoftDelete($relation)) { |
98 | - throw new LogicException('relationship ' . $relation . ' does not use SoftDeletes trait.'); |
|
96 | + throw new LogicException('relationship '.$relation.' does not use SoftDeletes trait.'); |
|
99 | 97 | } |
100 | 98 | |
101 | 99 | if (is_callable($item)) { |
@@ -167,7 +165,7 @@ discard block |
||
167 | 165 | $softDeletes = collect([]); |
168 | 166 | } |
169 | 167 | |
170 | - return $softDeletes->get($relation, function () use ($relation, $softDeletes) { |
|
168 | + return $softDeletes->get($relation, function() use ($relation, $softDeletes) { |
|
171 | 169 | $instance = new static; |
172 | 170 | $cls = $instance->{$relation}()->getRelated(); |
173 | 171 | $relationInstance = new $cls; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function register() |
15 | 15 | { |
16 | - $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'cascaded-soft-deletes'); |
|
16 | + $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'cascaded-soft-deletes'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | if ($this->app->runningInConsole()) { |
27 | 27 | $this->publishes([ |
28 | - __DIR__ . '/../config/config.php' => config_path('cascaded-soft-deletes.php'), |
|
28 | + __DIR__.'/../config/config.php' => config_path('cascaded-soft-deletes.php'), |
|
29 | 29 | ], 'config'); |
30 | 30 | } |
31 | 31 | } |