• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NIT-Administrative-Systems / er-diagram-tool / 13523807279

25 Feb 2025 02:38PM UTC coverage: 3.165% (-0.02%) from 3.185%
13523807279

Pull #6

github

nie7321
Update versions
Pull Request #6: Laravel 12

0 of 2 new or added lines in 1 file covered. (0.0%)

5 of 158 relevant lines covered (3.16%)

0.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Commands/LaravelERDCommand.php
1
<?php
2

3
namespace Kevincobain2000\LaravelERD\Commands;
4

5
use Illuminate\Console\Command;
6
use Illuminate\Support\Facades\File;
7
use Kevincobain2000\LaravelERD\Diagram\RoutingType;
8
use Kevincobain2000\LaravelERD\LaravelERD;
9

10
class LaravelERDCommand extends Command
11
{
12
    public $signature = 'erd:generate';
13

14
    public $description = 'Generate ERD files';
15

16
    private string $appName;
17

18
    private string $modelsPath;
19

20
    private string $destinationPath;
21

22
    private RoutingType $routingType;
23

24
    public function __construct()
25
    {
26
        parent::__construct();
×
27

28
        $this->modelsPath = config('laravel-erd.models_path');
×
29
        $this->destinationPath = config('laravel-erd.docs_path');
×
30
        $this->appName = config('app.name') ?? 'Laravel';
×
31

32
        $routing = config('laravel-erd.display.routing');
×
33
        if (is_string($routing)) {
×
34
            $routing = RoutingType::from($routing);
×
35
        }
36

37
        $this->routingType = $routing;
×
38
    }
39

40
    public function handle(LaravelERD $modelReflector): int
41
    {
42
        if (! File::exists($this->destinationPath)) {
×
43
            File::makeDirectory($this->destinationPath, 0755, true);
×
44
        }
45

46
        /**
47
         * I think the package erd:: prefix is confusing it; it doesn't see this as a view-string.
48
         *
49
         * @var view-string $view
50
         */
NEW
51
        $view = 'erd::index';
×
52

53
        File::put($this->destinationPath.'/index.html',
×
NEW
54
            view($view)
×
55
                ->with([
×
56
                    'appName' => $this->appName,
×
57
                    'routingType' => $this->routingType->value,
×
58
                    'link_data' => $modelReflector->getLinkDataArray($this->modelsPath),
×
59
                    'node_data' => $modelReflector->getNodeDataArray($this->modelsPath),
×
60
                ])
×
61
                ->render()
×
62
        );
×
63

64
        $this->info("ERD data written successfully to {$this->destinationPath}");
×
65

66
        return self::SUCCESS;
×
67
    }
68
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc