|
| 1 | +<?php |
| 2 | + |
| 3 | +use Illuminate\Database\Seeder; |
| 4 | +use Illuminate\Support\Facades\DB; |
| 5 | +use Illuminate\Support\Carbon; |
| 6 | + |
| 7 | +class PermissionsTableSeeder extends Seeder |
| 8 | +{ |
| 9 | + /** |
| 10 | + * Run the database seeds. |
| 11 | + * |
| 12 | + * @return void |
| 13 | + */ |
| 14 | + public function run() |
| 15 | + { |
| 16 | + // |
| 17 | + $id = DB::table('permissions') ->insertGetId([ |
| 18 | + 'name' => '学期管理', |
| 19 | + 'pid' => 0, |
| 20 | + 'type' => 1, |
| 21 | + 'method' => '', |
| 22 | + 'route_name' => '', |
| 23 | + 'route_match' => '', |
| 24 | + 'remark' => '管理学期信息', |
| 25 | + 'created_at' => Carbon::now(), |
| 26 | + 'updated_at' => Carbon::now() |
| 27 | + ]); |
| 28 | + DB::table('permissions') ->insert([ |
| 29 | + 'name' => '获取学期列表', |
| 30 | + 'pid' => $id, |
| 31 | + 'type' => 2, |
| 32 | + 'method' => 'GET', |
| 33 | + 'route_name' => 'session.index', |
| 34 | + 'route_match' => '/^\/api\/session$/', |
| 35 | + 'remark' => '获取学期列表信息', |
| 36 | + 'created_at' => Carbon::now(), |
| 37 | + 'updated_at' => Carbon::now() |
| 38 | + ]); |
| 39 | + |
| 40 | + DB::table('permissions') ->insert([ |
| 41 | + 'name' => '获取指定的学期信息', |
| 42 | + 'pid' => $id, |
| 43 | + 'type' => 2, |
| 44 | + 'method' => 'GET', |
| 45 | + 'route_name' => 'session.show', |
| 46 | + 'route_match' => '/^\/api\/session\/\d+$/', |
| 47 | + 'remark' => '获取指定的学期信息', |
| 48 | + 'created_at' => Carbon::now(), |
| 49 | + 'updated_at' => Carbon::now() |
| 50 | + ]); |
| 51 | + |
| 52 | + DB::table('permissions') ->insert([ |
| 53 | + 'name' => '创建新的学期信息', |
| 54 | + 'pid' => $id, |
| 55 | + 'type' => 2, |
| 56 | + 'method' => 'POST', |
| 57 | + 'route_name' => 'session.store', |
| 58 | + 'route_match' => '/^\/api\/session$/', |
| 59 | + 'remark' => '创建新的学期信息', |
| 60 | + 'created_at' => Carbon::now(), |
| 61 | + 'updated_at' => Carbon::now() |
| 62 | + ]); |
| 63 | + |
| 64 | + DB::table('permissions') ->insert([ |
| 65 | + 'name' => '更新指定的学期信息', |
| 66 | + 'pid' => $id, |
| 67 | + 'type' => 2, |
| 68 | + 'method' => 'PATCH', |
| 69 | + 'route_name' => 'session.update', |
| 70 | + 'route_match' => '/^\/api\/session\/\d+$/', |
| 71 | + 'remark' => '更新指定的学期信息', |
| 72 | + 'created_at' => Carbon::now(), |
| 73 | + 'updated_at' => Carbon::now() |
| 74 | + ]); |
| 75 | + |
| 76 | + DB::table('permissions') ->insert([ |
| 77 | + 'name' => '删除指定的学期信息', |
| 78 | + 'pid' => $id, |
| 79 | + 'type' => 2, |
| 80 | + 'method' => 'DELETE', |
| 81 | + 'route_name' => 'session.destroy', |
| 82 | + 'route_match' => '/^\/api\/session\/\d+$/', |
| 83 | + 'remark' => '删除指定的学期信息', |
| 84 | + 'created_at' => Carbon::now(), |
| 85 | + 'updated_at' => Carbon::now() |
| 86 | + ]); |
| 87 | + |
| 88 | + $id2 = DB::table('permissions') ->insertGetId([ |
| 89 | + 'name' => '行政管理', |
| 90 | + 'pid' => 0, |
| 91 | + 'type' => 1, |
| 92 | + 'method' => '', |
| 93 | + 'route_name' => '', |
| 94 | + 'route_match' => '', |
| 95 | + 'remark' => '管理行政信息', |
| 96 | + 'created_at' => Carbon::now(), |
| 97 | + 'updated_at' => Carbon::now() |
| 98 | + ]); |
| 99 | + |
| 100 | + } |
| 101 | +} |
0 commit comments