Issues (54)

src/Storage/factories/MenuFactory.php (1 issue)

1
<?php
2
3
use Illuminate\Support\Str;
4
use Faker\Generator as Faker;
0 ignored issues
show
The type Faker\Generator was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
use PhpCollective\MenuMaker\Storage\Menu;
6
7
$factory->define(Menu::class, function (Faker $faker) {
8
    return [
9
        'name'   => $faker->word,
10
        'alias' => $faker->unique()->slug,
11
        'routes' => implode(',', $faker->words()),
12
        'link'   => $faker->url,
13
        'icon'   => 'fa-' . Str::random(5),
14
        'class'  => Str::random(10)
15
    ];
16
});
17
18
$factory->state(Menu::class, 'section', function ($faker) {
19
    return [
20
        'name'   => $faker->word,
21
        'alias' => $faker->unique()->slug,
22
        'routes' => null,
23
        'link'   => null,
24
        'icon'   => null,
25
        'class'  => null
26
    ];
27
});
28
29
$factory->state(Menu::class, 'public', [
30
    'privilege' => 'PUBLIC'
31
]);
32
33
$factory->state(Menu::class, 'private', [
34
    'privilege' => 'PRIVATE'
35
]);
36
37
$factory->state(Menu::class, 'invisible', [
38
    'visible' => false
39
]);
40