Completed
Push — master ( f30158...bfbb50 )
by Sherif
02:18
created
src/Modules/Notifications/Http/Resources/Notification.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -6,25 +6,25 @@
 block discarded – undo
6 6
 
7 7
 class Notification extends JsonResource
8 8
 {
9
-    /**
10
-     * Transform the resource into an array.
11
-     *
12
-     * @param Request $request
13
-     * @return array
14
-     */
15
-    public function toArray($request)
16
-    {
17
-        if (! $this->resource) {
18
-            return [];
19
-        }
9
+	/**
10
+	 * Transform the resource into an array.
11
+	 *
12
+	 * @param Request $request
13
+	 * @return array
14
+	 */
15
+	public function toArray($request)
16
+	{
17
+		if (! $this->resource) {
18
+			return [];
19
+		}
20 20
 
21
-        return [
22
-            'id' => $this->id,
23
-            'type' => $this->type,
24
-            'data' => $this->data,
25
-            'read_at' => $this->read_at,
26
-            'created_at' => $this->created_at,
27
-            'updated_at' => $this->updated_at,
28
-        ];
29
-    }
21
+		return [
22
+			'id' => $this->id,
23
+			'type' => $this->type,
24
+			'data' => $this->data,
25
+			'read_at' => $this->read_at,
26
+			'created_at' => $this->created_at,
27
+			'updated_at' => $this->updated_at,
28
+		];
29
+	}
30 30
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
      */
18 18
     public function toArray($request)
19 19
     {
20
-        if (! $this->resource) {
20
+        if ( ! $this->resource) {
21 21
             return [];
22 22
         }
23 23
 
Please login to merge, or discard this patch.
src/Modules/Core/Core.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -4,26 +4,26 @@
 block discarded – undo
4 4
 
5 5
 class Core implements BaseFactoryInterface
6 6
 {
7
-    /**
8
-     * Construct the repository class name based on
9
-     * the method name called, search in the
10
-     * given namespaces for the class and
11
-     * return an instance.
12
-     *
13
-     * @param  string $name the called method name
14
-     * @param  array  $arguments the method arguments
15
-     * @return object
16
-     */
17
-    public function __call($name, $arguments)
18
-    {
19
-        foreach (\Module::all() as $module) {
20
-            $nameSpace = 'App\\Modules\\' . $module['basename'] ;
21
-            $model = ucfirst(\Str::singular($name));
22
-            $class = $nameSpace . '\\Repositories\\' . $model . 'Repository';
7
+	/**
8
+	 * Construct the repository class name based on
9
+	 * the method name called, search in the
10
+	 * given namespaces for the class and
11
+	 * return an instance.
12
+	 *
13
+	 * @param  string $name the called method name
14
+	 * @param  array  $arguments the method arguments
15
+	 * @return object
16
+	 */
17
+	public function __call($name, $arguments)
18
+	{
19
+		foreach (\Module::all() as $module) {
20
+			$nameSpace = 'App\\Modules\\' . $module['basename'] ;
21
+			$model = ucfirst(\Str::singular($name));
22
+			$class = $nameSpace . '\\Repositories\\' . $model . 'Repository';
23 23
 
24
-            if (class_exists($class)) {
25
-                return \App::make($class);
26
-            }
27
-        }
28
-    }
24
+			if (class_exists($class)) {
25
+				return \App::make($class);
26
+			}
27
+		}
28
+	}
29 29
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
     public function __call($name, $arguments)
18 18
     {
19 19
         foreach (\Module::all() as $module) {
20
-            $nameSpace = 'App\\Modules\\' . $module['basename'] ;
20
+            $nameSpace = 'App\\Modules\\'.$module['basename'];
21 21
             $model = ucfirst(\Str::singular($name));
22
-            $class = $nameSpace . '\\Repositories\\' . $model . 'Repository';
22
+            $class = $nameSpace.'\\Repositories\\'.$model.'Repository';
23 23
 
24 24
             if (class_exists($class)) {
25 25
                 return \App::make($class);
Please login to merge, or discard this patch.
src/Modules/Core/Routes/api.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 |
12 12
 */
13 13
 
14
-Route::group(['prefix' => 'settings'], function () {
14
+Route::group(['prefix' => 'settings'], function() {
15 15
         
16 16
     Route::get('/', 'SettingController@index');
17 17
     Route::get('/{id}', 'SettingController@find');
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@
 block discarded – undo
13 13
 
14 14
 Route::group(['prefix' => 'settings'], function () {
15 15
         
16
-    Route::get('/', 'SettingController@index');
17
-    Route::get('/{id}', 'SettingController@find');
18
-    Route::put('/', 'SettingController@update');
19
-    Route::delete('/{id}', 'SettingController@delete');
20
-    Route::get('list/deleted', 'SettingController@deleted');
21
-    Route::patch('restore/{id}', 'SettingController@restore');
22
-    Route::post('save/many', 'SettingController@saveMany');
16
+	Route::get('/', 'SettingController@index');
17
+	Route::get('/{id}', 'SettingController@find');
18
+	Route::put('/', 'SettingController@update');
19
+	Route::delete('/{id}', 'SettingController@delete');
20
+	Route::get('list/deleted', 'SettingController@deleted');
21
+	Route::patch('restore/{id}', 'SettingController@restore');
22
+	Route::post('save/many', 'SettingController@saveMany');
23 23
 });
Please login to merge, or discard this patch.
src/Modules/Core/Http/Resources/Setting.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -6,32 +6,32 @@
 block discarded – undo
6 6
 
7 7
 class Setting extends JsonResource
8 8
 {
9
-    /**
10
-     * Indicates if the resource's collection keys should be preserved.
11
-     *
12
-     * @var bool
13
-     */
14
-    public $preserveKeys = true;
9
+	/**
10
+	 * Indicates if the resource's collection keys should be preserved.
11
+	 *
12
+	 * @var bool
13
+	 */
14
+	public $preserveKeys = true;
15 15
 
16
-    /**
17
-     * Transform the resource into an array.
18
-     *
19
-     * @param Request $request
20
-     * @return array
21
-     */
22
-    public function toArray($request)
23
-    {
24
-        if (! $this->resource) {
25
-            return [];
26
-        }
16
+	/**
17
+	 * Transform the resource into an array.
18
+	 *
19
+	 * @param Request $request
20
+	 * @return array
21
+	 */
22
+	public function toArray($request)
23
+	{
24
+		if (! $this->resource) {
25
+			return [];
26
+		}
27 27
 
28
-        return [
29
-            'id' => $this->id,
30
-            'name' => $this->name,
31
-            'value' => $this->value,
32
-            'key' => $this->key,
33
-            'created_at' => $this->created_at,
34
-            'updated_at' => $this->updated_at,
35
-        ];
36
-    }
28
+		return [
29
+			'id' => $this->id,
30
+			'name' => $this->name,
31
+			'value' => $this->value,
32
+			'key' => $this->key,
33
+			'created_at' => $this->created_at,
34
+			'updated_at' => $this->updated_at,
35
+		];
36
+	}
37 37
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
      */
18 18
     public function toArray($request)
19 19
     {
20
-        if (! $this->resource) {
20
+        if ( ! $this->resource) {
21 21
             return [];
22 22
         }
23 23
 
Please login to merge, or discard this patch.
src/Modules/Reporting/Routes/api.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 |
12 12
 */
13 13
 
14
-Route::group(['prefix' => 'reports'], function () {
14
+Route::group(['prefix' => 'reports'], function() {
15 15
         
16 16
     Route::get('/', 'ReportController@index');
17 17
     Route::get('/{id}', 'ReportController@find');
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 
14 14
 Route::group(['prefix' => 'reports'], function () {
15 15
         
16
-    Route::get('/', 'ReportController@index');
17
-    Route::get('/{id}', 'ReportController@find');
18
-    Route::post('get/{reportName}', 'ReportController@getReport');
16
+	Route::get('/', 'ReportController@index');
17
+	Route::get('/{id}', 'ReportController@find');
18
+	Route::post('get/{reportName}', 'ReportController@getReport');
19 19
 });
Please login to merge, or discard this patch.
src/Modules/Reporting/Providers/ModuleServiceProvider.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@
 block discarded – undo
6 6
 
7 7
 class ModuleServiceProvider extends ServiceProvider
8 8
 {
9
-    /**
10
-     * Bootstrap the module services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'reporting');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'reporting');
9
+	/**
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'reporting');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'reporting');
18 18
 
19
-        $this->loadMigrationsFrom(module_path('reporting', 'Database/Migrations', 'app'));
20
-        $this->loadFactoriesFrom(module_path('reporting', 'Database/Factories', 'app'));
21
-    }
19
+		$this->loadMigrationsFrom(module_path('reporting', 'Database/Migrations', 'app'));
20
+		$this->loadFactoriesFrom(module_path('reporting', 'Database/Factories', 'app'));
21
+	}
22 22
 
23
-    /**
24
-     * Register the module services.
25
-     *
26
-     * @return void
27
-     */
28
-    public function register()
29
-    {
30
-        $this->app->register(RouteServiceProvider::class);
31
-    }
23
+	/**
24
+	 * Register the module services.
25
+	 *
26
+	 * @return void
27
+	 */
28
+	public function register()
29
+	{
30
+		$this->app->register(RouteServiceProvider::class);
31
+	}
32 32
 }
Please login to merge, or discard this patch.
src/Modules/Reporting/Http/Resources/Report.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -6,24 +6,24 @@
 block discarded – undo
6 6
 
7 7
 class Report extends JsonResource
8 8
 {
9
-    /**
10
-     * Transform the resource into an array.
11
-     *
12
-     * @param Request $request
13
-     * @return array
14
-     */
15
-    public function toArray($request)
16
-    {
17
-        if (! $this->resource) {
18
-            return [];
19
-        }
9
+	/**
10
+	 * Transform the resource into an array.
11
+	 *
12
+	 * @param Request $request
13
+	 * @return array
14
+	 */
15
+	public function toArray($request)
16
+	{
17
+		if (! $this->resource) {
18
+			return [];
19
+		}
20 20
 
21
-        return [
22
-            'id' => $this->id,
23
-            'report_name' => $this->report_name,
24
-            'view_name' => $this->view_name,
25
-            'created_at' => $this->created_at,
26
-            'updated_at' => $this->updated_at,
27
-        ];
28
-    }
21
+		return [
22
+			'id' => $this->id,
23
+			'report_name' => $this->report_name,
24
+			'view_name' => $this->view_name,
25
+			'created_at' => $this->created_at,
26
+			'updated_at' => $this->updated_at,
27
+		];
28
+	}
29 29
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
      */
18 18
     public function toArray($request)
19 19
     {
20
-        if (! $this->resource) {
20
+        if ( ! $this->resource) {
21 21
             return [];
22 22
         }
23 23
 
Please login to merge, or discard this patch.
src/Modules/Core/Console/Commands/MakeModuleCommand.php 3 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -183,6 +183,11 @@
 block discarded – undo
183 183
         }
184 184
     }
185 185
 
186
+    /**
187
+     * @param string $contents
188
+     *
189
+     * @return string
190
+     */
186 191
     protected function replacePlaceholders($contents)
187 192
     {
188 193
         $modelName = \Str::camel($this->container['slug']);
Please login to merge, or discard this patch.
Indentation   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -10,243 +10,243 @@
 block discarded – undo
10 10
 
11 11
 class MakeModuleCommand extends Command
12 12
 {
13
-    /**
14
-     * The name and signature of the console command.
15
-     *
16
-     * @var string
17
-     */
18
-    protected $signature = 'generate:module
13
+	/**
14
+	 * The name and signature of the console command.
15
+	 *
16
+	 * @var string
17
+	 */
18
+	protected $signature = 'generate:module
19 19
         {slug : The slug of the module}';
20 20
 
21
-    /**
22
-     * The console command description.
23
-     *
24
-     * @var string
25
-     */
26
-    protected $description = 'Create a new module';
27
-
28
-    /**
29
-     * The modules instance.
30
-     *
31
-     * @var RepositoryManager
32
-     */
33
-    protected $module;
34
-
35
-    /**
36
-     * The filesystem instance.
37
-     *
38
-     * @var Filesystem
39
-     */
40
-    protected $files;
41
-
42
-    /**
43
-     * Array to store the configuration details.
44
-     *
45
-     * @var array
46
-     */
47
-    protected $container;
48
-
49
-    /**
50
-     * Array of folder mappings.
51
-     *
52
-     * @var Array
53
-     */
54
-    protected $mapping = [
55
-        'Database/Factories'  => 'Database/Factories',
56
-        'Database/Migrations' => 'Database/Migrations',
57
-        'Database/Seeds'      => 'Database/Seeds',
58
-        'Http/Controllers'    => 'Http/Controllers',
59
-        'Http/Requests'       => 'Http/Requests',
60
-        'Http/Resources'      => 'Http/Resources',
61
-        'ModelObservers'      => 'ModelObservers',
62
-        'Providers'           => 'Providers',
63
-        'Repositories'        => 'Repositories',
64
-        'Services'            => 'Services',
65
-        'Routes'              => 'Routes',
66
-        'Errors'              => 'Errors',
67
-    ];
68
-
69
-    /**
70
-     * Create a new command instance.
71
-     *
72
-     * @param Filesystem $files
73
-     * @param RepositoryManager $module
74
-     */
75
-    public function __construct(Filesystem $files, RepositoryManager $module)
76
-    {
77
-        parent::__construct();
78
-
79
-        $this->files = $files;
80
-        $this->module = $module;
81
-    }
82
-
83
-    /**
84
-     * Execute the console command.
85
-     *
86
-     * @return mixed
87
-     */
88
-    public function handle()
89
-    {
90
-        $this->container['slug']        = Str::slug($this->argument('slug'));
91
-        $this->container['name']        = Str::studly($this->container['slug']);
92
-        $this->container['version']     = '1.0';
93
-        $this->container['description'] = 'This is the description for the ' . $this->container['name'] . ' module.';
94
-        $this->container['location']    = config('modules.default_location');
95
-        $this->container['provider']    = config("modules.locations.{$this->container['location']}.provider");
96
-        $this->container['basename']    = Str::studly($this->container['slug']);
97
-        $this->container['namespace']   = config("modules.locations.{$this->container['location']}.namespace").$this->container['basename'];
98
-
99
-        return $this->generate();
100
-    }
101
-
102
-    /**
103
-     * Generate the module.
104
-     */
105
-    protected function generate()
106
-    {
107
-        $steps = [
108
-            'Generating module...' => 'generateModule',
109
-            'Optimizing module cache...' => 'optimizeModules',
110
-            'Generating migrations...' => 'generateMigration',
111
-        ];
112
-
113
-        $progress = new ProgressBar($this->output, count($steps));
114
-        $progress->start();
115
-
116
-        foreach ($steps as $message => $function) {
117
-            $progress->setMessage($message);
118
-
119
-            $this->$function();
120
-
121
-            $progress->advance();
122
-        }
123
-
124
-        $progress->finish();
125
-
126
-        event($this->container['slug'] . '.module.made');
127
-
128
-        $this->info("\nModule generated successfully.");
129
-    }
130
-
131
-    /**
132
-     * Generate defined module folders.
133
-     */
134
-    protected function generateModule()
135
-    {
136
-        $location = $this->container['location'];
137
-        $root     = module_path(null, '', $location);
138
-        $manifest = config("modules.locations.$location.manifest") ?: 'module.json';
139
-        $provider = config("modules.locations.$location.provider") ?: 'ModuleServiceProvider';
140
-
141
-        if (!$this->files->isDirectory($root)) {
142
-            $this->files->makeDirectory($root);
143
-        }
144
-
145
-        $directory = module_path(null, $this->container['basename'], $location);
146
-        $source    = __DIR__ . '/Stubs/Module';
147
-
148
-        $this->files->makeDirectory($directory);
149
-
150
-        $sourceFiles = $this->files->allFiles($source, true);
151
-
152
-        if (!empty($this->mapping)) {
153
-            $search = array_keys($this->mapping);
154
-            $replace = array_values($this->mapping);
155
-        }
156
-
157
-        foreach ($sourceFiles as $file) {
158
-            $contents = $this->replacePlaceholders($file->getContents());
159
-            $subPath = $file->getRelativePathname();
160
-
161
-            if (!empty($this->mapping)) {
162
-                $subPath = str_replace($search, $replace, $subPath);
163
-            }
164
-
165
-            $filePath = $directory . '/' . $subPath;
21
+	/**
22
+	 * The console command description.
23
+	 *
24
+	 * @var string
25
+	 */
26
+	protected $description = 'Create a new module';
27
+
28
+	/**
29
+	 * The modules instance.
30
+	 *
31
+	 * @var RepositoryManager
32
+	 */
33
+	protected $module;
34
+
35
+	/**
36
+	 * The filesystem instance.
37
+	 *
38
+	 * @var Filesystem
39
+	 */
40
+	protected $files;
41
+
42
+	/**
43
+	 * Array to store the configuration details.
44
+	 *
45
+	 * @var array
46
+	 */
47
+	protected $container;
48
+
49
+	/**
50
+	 * Array of folder mappings.
51
+	 *
52
+	 * @var Array
53
+	 */
54
+	protected $mapping = [
55
+		'Database/Factories'  => 'Database/Factories',
56
+		'Database/Migrations' => 'Database/Migrations',
57
+		'Database/Seeds'      => 'Database/Seeds',
58
+		'Http/Controllers'    => 'Http/Controllers',
59
+		'Http/Requests'       => 'Http/Requests',
60
+		'Http/Resources'      => 'Http/Resources',
61
+		'ModelObservers'      => 'ModelObservers',
62
+		'Providers'           => 'Providers',
63
+		'Repositories'        => 'Repositories',
64
+		'Services'            => 'Services',
65
+		'Routes'              => 'Routes',
66
+		'Errors'              => 'Errors',
67
+	];
68
+
69
+	/**
70
+	 * Create a new command instance.
71
+	 *
72
+	 * @param Filesystem $files
73
+	 * @param RepositoryManager $module
74
+	 */
75
+	public function __construct(Filesystem $files, RepositoryManager $module)
76
+	{
77
+		parent::__construct();
78
+
79
+		$this->files = $files;
80
+		$this->module = $module;
81
+	}
82
+
83
+	/**
84
+	 * Execute the console command.
85
+	 *
86
+	 * @return mixed
87
+	 */
88
+	public function handle()
89
+	{
90
+		$this->container['slug']        = Str::slug($this->argument('slug'));
91
+		$this->container['name']        = Str::studly($this->container['slug']);
92
+		$this->container['version']     = '1.0';
93
+		$this->container['description'] = 'This is the description for the ' . $this->container['name'] . ' module.';
94
+		$this->container['location']    = config('modules.default_location');
95
+		$this->container['provider']    = config("modules.locations.{$this->container['location']}.provider");
96
+		$this->container['basename']    = Str::studly($this->container['slug']);
97
+		$this->container['namespace']   = config("modules.locations.{$this->container['location']}.namespace").$this->container['basename'];
98
+
99
+		return $this->generate();
100
+	}
101
+
102
+	/**
103
+	 * Generate the module.
104
+	 */
105
+	protected function generate()
106
+	{
107
+		$steps = [
108
+			'Generating module...' => 'generateModule',
109
+			'Optimizing module cache...' => 'optimizeModules',
110
+			'Generating migrations...' => 'generateMigration',
111
+		];
112
+
113
+		$progress = new ProgressBar($this->output, count($steps));
114
+		$progress->start();
115
+
116
+		foreach ($steps as $message => $function) {
117
+			$progress->setMessage($message);
118
+
119
+			$this->$function();
120
+
121
+			$progress->advance();
122
+		}
123
+
124
+		$progress->finish();
125
+
126
+		event($this->container['slug'] . '.module.made');
127
+
128
+		$this->info("\nModule generated successfully.");
129
+	}
130
+
131
+	/**
132
+	 * Generate defined module folders.
133
+	 */
134
+	protected function generateModule()
135
+	{
136
+		$location = $this->container['location'];
137
+		$root     = module_path(null, '', $location);
138
+		$manifest = config("modules.locations.$location.manifest") ?: 'module.json';
139
+		$provider = config("modules.locations.$location.provider") ?: 'ModuleServiceProvider';
140
+
141
+		if (!$this->files->isDirectory($root)) {
142
+			$this->files->makeDirectory($root);
143
+		}
144
+
145
+		$directory = module_path(null, $this->container['basename'], $location);
146
+		$source    = __DIR__ . '/Stubs/Module';
147
+
148
+		$this->files->makeDirectory($directory);
149
+
150
+		$sourceFiles = $this->files->allFiles($source, true);
151
+
152
+		if (!empty($this->mapping)) {
153
+			$search = array_keys($this->mapping);
154
+			$replace = array_values($this->mapping);
155
+		}
156
+
157
+		foreach ($sourceFiles as $file) {
158
+			$contents = $this->replacePlaceholders($file->getContents());
159
+			$subPath = $file->getRelativePathname();
160
+
161
+			if (!empty($this->mapping)) {
162
+				$subPath = str_replace($search, $replace, $subPath);
163
+			}
164
+
165
+			$filePath = $directory . '/' . $subPath;
166 166
             
167
-            // if the file is module.json, replace it with the custom manifest file name
168
-            if ($file->getFilename() === 'module.json' && $manifest) {
169
-                $filePath = str_replace('module.json', $manifest, $filePath);
170
-            }
167
+			// if the file is module.json, replace it with the custom manifest file name
168
+			if ($file->getFilename() === 'module.json' && $manifest) {
169
+				$filePath = str_replace('module.json', $manifest, $filePath);
170
+			}
171 171
             
172
-            // if the file is ModuleServiceProvider.php, replace it with the custom provider file name
173
-            if ($file->getFilename() === 'ModuleServiceProvider.php') {
174
-                $filePath = str_replace('ModuleServiceProvider', $provider, $filePath);
175
-            }
176
-            $filePath = $this->replacePlaceholders($filePath);
172
+			// if the file is ModuleServiceProvider.php, replace it with the custom provider file name
173
+			if ($file->getFilename() === 'ModuleServiceProvider.php') {
174
+				$filePath = str_replace('ModuleServiceProvider', $provider, $filePath);
175
+			}
176
+			$filePath = $this->replacePlaceholders($filePath);
177 177
             
178
-            $dir = dirname($filePath);
178
+			$dir = dirname($filePath);
179 179
             
180
-            if (! $this->files->isDirectory($dir)) {
181
-                $this->files->makeDirectory($dir, 0755, true);
182
-            }
183
-
184
-            $this->files->put($filePath, $contents);
185
-        }
186
-    }
187
-
188
-    protected function replacePlaceholders($contents)
189
-    {
190
-        $modelName = \Str::camel($this->container['slug']);
191
-        $modelNameSingular = \Str::singular($modelName);
192
-
193
-        $find = [
194
-            'DummyFactory',
195
-            'DummyModelName',
196
-            'DummyModuleSlug',
197
-            'DummyModule',
198
-            'DummyModel',
199
-            'DummyDatabaseSeeder',
200
-            'DummyTableSeeder',
201
-            'DummyController',
202
-            'DummyService',
203
-            'DummyRepository',
204
-            'DummyErrors',
205
-            'InsertDummy',
206
-            'UpdateDummy',
207
-            'DummyResource',
208
-            'DummyObserver',
209
-            'DummyTableName',
210
-            'DummyRoutePrefix',
211
-        ];
212
-
213
-        $replace = [
214
-            ucfirst($modelNameSingular) . 'Factory',
215
-            $modelNameSingular,
216
-            $this->container['slug'],
217
-            ucfirst($modelName),
218
-            ucfirst($modelNameSingular),
219
-            ucfirst($modelName) . 'DatabaseSeeder',
220
-            ucfirst($modelName) . 'TableSeeder',
221
-            ucfirst($modelNameSingular) . 'Controller',
222
-            ucfirst($modelNameSingular) . 'Service',
223
-            ucfirst($modelNameSingular) . 'Repository',
224
-            ucfirst($modelName) . 'Errors',
225
-            'Insert' . ucfirst($modelNameSingular),
226
-            'Update' . ucfirst($modelNameSingular),
227
-            ucfirst($modelNameSingular),
228
-            ucfirst($modelNameSingular) . 'Observer',
229
-            $modelName,
230
-            $modelName,
231
-        ];
232
-
233
-        return str_replace($find, $replace, $contents);
234
-    }
235
-
236
-    /**
237
-     * Reset module cache of enabled and disabled modules.
238
-     */
239
-    protected function optimizeModules()
240
-    {
241
-        return $this->callSilent('module:optimize');
242
-    }
243
-
244
-    /**
245
-     * Generate table migrations.
246
-     */
247
-    protected function generateMigration()
248
-    {
249
-        $modelName = $this->container['slug'];
250
-        return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_' . $modelName . '_table']);
251
-    }
180
+			if (! $this->files->isDirectory($dir)) {
181
+				$this->files->makeDirectory($dir, 0755, true);
182
+			}
183
+
184
+			$this->files->put($filePath, $contents);
185
+		}
186
+	}
187
+
188
+	protected function replacePlaceholders($contents)
189
+	{
190
+		$modelName = \Str::camel($this->container['slug']);
191
+		$modelNameSingular = \Str::singular($modelName);
192
+
193
+		$find = [
194
+			'DummyFactory',
195
+			'DummyModelName',
196
+			'DummyModuleSlug',
197
+			'DummyModule',
198
+			'DummyModel',
199
+			'DummyDatabaseSeeder',
200
+			'DummyTableSeeder',
201
+			'DummyController',
202
+			'DummyService',
203
+			'DummyRepository',
204
+			'DummyErrors',
205
+			'InsertDummy',
206
+			'UpdateDummy',
207
+			'DummyResource',
208
+			'DummyObserver',
209
+			'DummyTableName',
210
+			'DummyRoutePrefix',
211
+		];
212
+
213
+		$replace = [
214
+			ucfirst($modelNameSingular) . 'Factory',
215
+			$modelNameSingular,
216
+			$this->container['slug'],
217
+			ucfirst($modelName),
218
+			ucfirst($modelNameSingular),
219
+			ucfirst($modelName) . 'DatabaseSeeder',
220
+			ucfirst($modelName) . 'TableSeeder',
221
+			ucfirst($modelNameSingular) . 'Controller',
222
+			ucfirst($modelNameSingular) . 'Service',
223
+			ucfirst($modelNameSingular) . 'Repository',
224
+			ucfirst($modelName) . 'Errors',
225
+			'Insert' . ucfirst($modelNameSingular),
226
+			'Update' . ucfirst($modelNameSingular),
227
+			ucfirst($modelNameSingular),
228
+			ucfirst($modelNameSingular) . 'Observer',
229
+			$modelName,
230
+			$modelName,
231
+		];
232
+
233
+		return str_replace($find, $replace, $contents);
234
+	}
235
+
236
+	/**
237
+	 * Reset module cache of enabled and disabled modules.
238
+	 */
239
+	protected function optimizeModules()
240
+	{
241
+		return $this->callSilent('module:optimize');
242
+	}
243
+
244
+	/**
245
+	 * Generate table migrations.
246
+	 */
247
+	protected function generateMigration()
248
+	{
249
+		$modelName = $this->container['slug'];
250
+		return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_' . $modelName . '_table']);
251
+	}
252 252
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         $this->container['slug']        = Str::slug($this->argument('slug'));
91 91
         $this->container['name']        = Str::studly($this->container['slug']);
92 92
         $this->container['version']     = '1.0';
93
-        $this->container['description'] = 'This is the description for the ' . $this->container['name'] . ' module.';
93
+        $this->container['description'] = 'This is the description for the '.$this->container['name'].' module.';
94 94
         $this->container['location']    = config('modules.default_location');
95 95
         $this->container['provider']    = config("modules.locations.{$this->container['location']}.provider");
96 96
         $this->container['basename']    = Str::studly($this->container['slug']);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
         $progress->finish();
125 125
 
126
-        event($this->container['slug'] . '.module.made');
126
+        event($this->container['slug'].'.module.made');
127 127
 
128 128
         $this->info("\nModule generated successfully.");
129 129
     }
@@ -138,18 +138,18 @@  discard block
 block discarded – undo
138 138
         $manifest = config("modules.locations.$location.manifest") ?: 'module.json';
139 139
         $provider = config("modules.locations.$location.provider") ?: 'ModuleServiceProvider';
140 140
 
141
-        if (!$this->files->isDirectory($root)) {
141
+        if ( ! $this->files->isDirectory($root)) {
142 142
             $this->files->makeDirectory($root);
143 143
         }
144 144
 
145 145
         $directory = module_path(null, $this->container['basename'], $location);
146
-        $source    = __DIR__ . '/Stubs/Module';
146
+        $source    = __DIR__.'/Stubs/Module';
147 147
 
148 148
         $this->files->makeDirectory($directory);
149 149
 
150 150
         $sourceFiles = $this->files->allFiles($source, true);
151 151
 
152
-        if (!empty($this->mapping)) {
152
+        if ( ! empty($this->mapping)) {
153 153
             $search = array_keys($this->mapping);
154 154
             $replace = array_values($this->mapping);
155 155
         }
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
             $contents = $this->replacePlaceholders($file->getContents());
159 159
             $subPath = $file->getRelativePathname();
160 160
 
161
-            if (!empty($this->mapping)) {
161
+            if ( ! empty($this->mapping)) {
162 162
                 $subPath = str_replace($search, $replace, $subPath);
163 163
             }
164 164
 
165
-            $filePath = $directory . '/' . $subPath;
165
+            $filePath = $directory.'/'.$subPath;
166 166
             
167 167
             // if the file is module.json, replace it with the custom manifest file name
168 168
             if ($file->getFilename() === 'module.json' && $manifest) {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             
178 178
             $dir = dirname($filePath);
179 179
             
180
-            if (! $this->files->isDirectory($dir)) {
180
+            if ( ! $this->files->isDirectory($dir)) {
181 181
                 $this->files->makeDirectory($dir, 0755, true);
182 182
             }
183 183
 
@@ -211,21 +211,21 @@  discard block
 block discarded – undo
211 211
         ];
212 212
 
213 213
         $replace = [
214
-            ucfirst($modelNameSingular) . 'Factory',
214
+            ucfirst($modelNameSingular).'Factory',
215 215
             $modelNameSingular,
216 216
             $this->container['slug'],
217 217
             ucfirst($modelName),
218 218
             ucfirst($modelNameSingular),
219
-            ucfirst($modelName) . 'DatabaseSeeder',
220
-            ucfirst($modelName) . 'TableSeeder',
221
-            ucfirst($modelNameSingular) . 'Controller',
222
-            ucfirst($modelNameSingular) . 'Service',
223
-            ucfirst($modelNameSingular) . 'Repository',
224
-            ucfirst($modelName) . 'Errors',
225
-            'Insert' . ucfirst($modelNameSingular),
226
-            'Update' . ucfirst($modelNameSingular),
219
+            ucfirst($modelName).'DatabaseSeeder',
220
+            ucfirst($modelName).'TableSeeder',
221
+            ucfirst($modelNameSingular).'Controller',
222
+            ucfirst($modelNameSingular).'Service',
223
+            ucfirst($modelNameSingular).'Repository',
224
+            ucfirst($modelName).'Errors',
225
+            'Insert'.ucfirst($modelNameSingular),
226
+            'Update'.ucfirst($modelNameSingular),
227 227
             ucfirst($modelNameSingular),
228
-            ucfirst($modelNameSingular) . 'Observer',
228
+            ucfirst($modelNameSingular).'Observer',
229 229
             $modelName,
230 230
             $modelName,
231 231
         ];
@@ -247,6 +247,6 @@  discard block
 block discarded – undo
247 247
     protected function generateMigration()
248 248
     {
249 249
         $modelName = $this->container['slug'];
250
-        return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_' . $modelName . '_table']);
250
+        return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_'.$modelName.'_table']);
251 251
     }
252 252
 }
Please login to merge, or discard this patch.
src/Modules/Core/Console/Commands/Stubs/Module/Routes/api.php 3 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-use Illuminate\Http\Request;
4
-
5 3
 /*
6 4
 |--------------------------------------------------------------------------
7 5
 | API Routes
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
 
16 16
 Route::group(['prefix' => 'DummyRoutePrefix'], function () {
17 17
 
18
-    Route::get('/', 'DummyController@index');
19
-    Route::get('/{id}', 'DummyController@find');
20
-    Route::post('/', 'DummyController@insert');
21
-    Route::put('/', 'DummyController@update');
22
-    Route::delete('/{id}', 'DummyController@delete');
23
-    Route::get('list/deleted', 'DummyController@deleted');
24
-    Route::patch('restore/{id}', 'DummyController@restore');
18
+	Route::get('/', 'DummyController@index');
19
+	Route::get('/{id}', 'DummyController@find');
20
+	Route::post('/', 'DummyController@insert');
21
+	Route::put('/', 'DummyController@update');
22
+	Route::delete('/{id}', 'DummyController@delete');
23
+	Route::get('list/deleted', 'DummyController@deleted');
24
+	Route::patch('restore/{id}', 'DummyController@restore');
25 25
 });
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 |
14 14
 */
15 15
 
16
-Route::group(['prefix' => 'DummyRoutePrefix'], function () {
16
+Route::group(['prefix' => 'DummyRoutePrefix'], function() {
17 17
 
18 18
     Route::get('/', 'DummyController@index');
19 19
     Route::get('/{id}', 'DummyController@find');
Please login to merge, or discard this patch.