1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace jeremykenedy\LaravelBlocker\Database\Seeds; |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Seeder; |
|
|
|
|
6
|
|
|
use jeremykenedy\LaravelBlocker\App\Models\BlockedItem; |
7
|
|
|
use jeremykenedy\LaravelBlocker\App\Models\BlockedType; |
8
|
|
|
|
9
|
|
|
class DefaultBlockedItemsTableSeeder extends Seeder |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* Run the database seeds. |
13
|
|
|
* |
14
|
|
|
* @return void |
15
|
|
|
*/ |
16
|
|
|
public function run() |
17
|
|
|
{ |
18
|
|
|
/* |
19
|
|
|
* Blocked Types |
20
|
|
|
* |
21
|
|
|
*/ |
22
|
|
|
$BlockedItems = [ |
23
|
|
|
[ |
24
|
|
|
'type' => 'domain', |
25
|
|
|
'value' => 'test.com', |
26
|
|
|
'note' => 'Block all domains/emails @test.com', |
27
|
|
|
], |
28
|
|
|
[ |
29
|
|
|
'type' => 'domain', |
30
|
|
|
'value' => 'test.ca', |
31
|
|
|
'note' => 'Block all domains/emails @test.ca', |
32
|
|
|
], |
33
|
|
|
[ |
34
|
|
|
'type' => 'domain', |
35
|
|
|
'value' => 'fake.com', |
36
|
|
|
'note' => 'Block all domains/emails @fake.com', |
37
|
|
|
], |
38
|
|
|
[ |
39
|
|
|
'type' => 'domain', |
40
|
|
|
'value' => 'example.com', |
41
|
|
|
'note' => 'Block all domains/emails @example.com', |
42
|
|
|
], |
43
|
|
|
[ |
44
|
|
|
'type' => 'domain', |
45
|
|
|
'value' => 'mailinator.com', |
46
|
|
|
'note' => 'Block all domains/emails @mailinator.com', |
47
|
|
|
], |
48
|
|
|
]; |
49
|
|
|
|
50
|
|
|
/* |
51
|
|
|
* Add Blocked Items |
52
|
|
|
* |
53
|
|
|
*/ |
54
|
|
|
foreach ($BlockedItems as $BlockedItem) { |
55
|
|
|
$blockType = BlockedType::where('slug', $BlockedItem['type'])->first(); |
56
|
|
|
$newBlockedItem = BlockedItem::where('typeId', '=', $blockType->id) |
57
|
|
|
->where('value', '=', $BlockedItem['value']) |
58
|
|
|
->withTrashed() |
59
|
|
|
->first(); |
60
|
|
|
if ($newBlockedItem === null) { |
61
|
|
|
$newBlockedItem = BlockedItem::create([ |
|
|
|
|
62
|
|
|
'typeId' => $blockType->id, |
63
|
|
|
'value' => $BlockedItem['value'], |
64
|
|
|
'note' => $BlockedItem['note'], |
65
|
|
|
]); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
echo "\e[32mSeeding:\e[0m DefaultBlockedItemsTableSeeder\r\n"; |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths