1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Mtolhuys\LaravelSchematics\Http\Controllers; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\Facades\Artisan; |
6
|
|
|
use Illuminate\Routing\Controller; |
7
|
|
|
use Illuminate\Support\Facades\Cache; |
8
|
|
|
use Mtolhuys\LaravelSchematics\Actions\Migration\DeleteLastMigrationAction; |
9
|
|
|
|
10
|
|
|
class MigrationsController extends Controller |
11
|
|
|
{ |
12
|
|
|
public function run() |
13
|
|
|
{ |
14
|
|
|
Artisan::call('migrate'); |
15
|
|
|
|
16
|
|
|
Cache::forget('schematics'); |
17
|
|
|
|
18
|
|
|
return Artisan::output(); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function rollback() |
22
|
|
|
{ |
23
|
|
|
Artisan::call('migrate:rollback'); |
24
|
|
|
|
25
|
|
|
Cache::forget('schematics'); |
26
|
|
|
|
27
|
|
|
return Artisan::output(); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function seed() |
31
|
|
|
{ |
32
|
|
|
Artisan::call('db:seed'); |
33
|
|
|
|
34
|
|
|
Cache::forget('schematics'); |
35
|
|
|
|
36
|
|
|
return Artisan::output(); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function refresh() |
40
|
|
|
{ |
41
|
|
|
Artisan::call('migrate:refresh', [ |
42
|
|
|
'--force' => true, |
43
|
|
|
]); |
44
|
|
|
|
45
|
|
|
Cache::forget('schematics'); |
46
|
|
|
|
47
|
|
|
return Artisan::output(); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function fresh() |
51
|
|
|
{ |
52
|
|
|
Artisan::call('migrate:fresh'); |
53
|
|
|
|
54
|
|
|
Cache::forget('schematics'); |
55
|
|
|
|
56
|
|
|
return Artisan::output(); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function deleteLast() |
60
|
|
|
{ |
61
|
|
|
(new DeleteLastMigrationAction())->execute(); |
62
|
|
|
|
63
|
|
|
Cache::forget('schematics'); |
64
|
|
|
|
65
|
|
|
return response('Last migration removed', 200); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|