RouteCommands::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * @Author: bantenprov
5
 * @Date:   2017-11-27 23:39:21
6
 * @Last Modified by:   bantenprov
7
 * @Last Modified time: 2017-11-28 00:29:26
8
 */
9
10
namespace Bantenprov\LaravelApiManager\Commands;
11
12
use Illuminate\Console\Command;
13
use Illuminate\Support\Facades\Config;
14
use Symfony\Component\Console\Input\InputOption;
15
use Symfony\Component\Console\Input\InputArgument;
16
use File;
17
18
class RouteCommands extends Command
19
{
20
    /**
21
     * The name and signature of the console command.
22
     *
23
     * @var string
24
     */
25
    protected $signature = 'laravel-api-manager:add-route';
26
27
    /**
28
     * The console command description.
29
     *
30
     * @var string
31
     */
32
    protected $description = 'Add api manager to route';
33
34
    /**
35
     * Create a new command instance.
36
     *
37
     * @return void
38
     */
39
40
    protected $drip;
41
42
    public function __construct()
43
    {
44
        parent::__construct();
45
46
    }
47
48
    /**
49
     * Execute the console command.
50
     *
51
     * @return mixed
52
     */
53
54
    protected function content()
55
    {
56
57
        $replace_middleware = File::get(__DIR__.'/../stubs/route.stub');
58
        return $replace_middleware;
59
    }
60
61
   protected function contentApi()
62
   {
63
64
       $replace_middleware = File::get(__DIR__.'/../stubs/routeApi.stub');
65
       return $replace_middleware;
66
   }
67
68
69
    public function handle()
70
    {
71
        $this->info('Route add success'); 
72
        File::append(base_path('routes/web.php'),"\n".$this->content());
73
        File::append(base_path('routes/api.php'),"\n".$this->contentApi());
74
    }
75
}
76