deviouspk /
larapi
| 1 | <?php |
||||||
| 2 | /** |
||||||
| 3 | * Created by PhpStorm. |
||||||
| 4 | * User: arthur |
||||||
| 5 | * Date: 11.10.18 |
||||||
| 6 | * Time: 22:53. |
||||||
| 7 | */ |
||||||
| 8 | |||||||
| 9 | namespace Foundation\Traits; |
||||||
| 10 | |||||||
| 11 | use Illuminate\Foundation\Testing\DatabaseMigrations; |
||||||
| 12 | use Illuminate\Foundation\Testing\RefreshDatabaseState; |
||||||
| 13 | |||||||
| 14 | trait RefreshDatabase |
||||||
| 15 | { |
||||||
| 16 | use DatabaseMigrations { |
||||||
| 17 | DatabaseMigrations::runDatabaseMigrations as parentMethod; |
||||||
| 18 | } |
||||||
| 19 | |||||||
| 20 | public function runDatabaseMigrations() |
||||||
| 21 | { |
||||||
| 22 | $this->artisan('cache:model:clear'); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 23 | |||||||
| 24 | /* If refresh fails. It usually means the database was only partially migrated or seeded. |
||||||
| 25 | ** Start fresh if that's the case |
||||||
| 26 | **/ |
||||||
| 27 | try { |
||||||
| 28 | $this->artisan('migrate:refresh'); |
||||||
| 29 | } catch (\Exception $e) { |
||||||
| 30 | $this->artisan('cache:model:clear'); |
||||||
| 31 | $this->artisan('migrate:fresh'); |
||||||
| 32 | $this->artisan('migrate:refresh'); |
||||||
| 33 | } |
||||||
| 34 | $this->artisan('db:seed'); |
||||||
| 35 | $this->beforeApplicationDestroyed(function () { |
||||||
|
0 ignored issues
–
show
It seems like
beforeApplicationDestroyed() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 36 | RefreshDatabaseState::$migrated = false; |
||||||
| 37 | }); |
||||||
| 38 | } |
||||||
| 39 | } |
||||||
| 40 |