Skip to content

Commit 14122c7

Browse files
committed
Added ClassController stub
1 parent 9b6998a commit 14122c7

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

src/ClassControllerServiceProvider.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ public function boot()
2121

2222
if ($this->app->runningInConsole()) {
2323
$this->publishes([
24-
__DIR__.'/../config/config.php' => config_path('classcontroller.php'),
24+
__DIR__ . '/../config/config.php' => config_path('classcontroller.php'),
2525
], 'config');
2626

27+
// Publish the stubs
28+
$this->publishes([
29+
__DIR__ . '/../stubs' => base_path('stubs'),
30+
], 'stubs');
31+
2732
// Publishing the views.
2833
/*$this->publishes([
2934
__DIR__.'/../resources/views' => resource_path('views/vendor/classcontroller'),
@@ -50,7 +55,7 @@ public function boot()
5055
public function register()
5156
{
5257
// Automatically apply the package configuration
53-
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'classcontroller');
58+
$this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'classcontroller');
5459

5560
// Register the main class to use with the facade
5661
$this->app->singleton('classcontroller', function () {

stubs/controller.class.stub

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
use MMedia\ClassController\Http\Controllers\ClassController;
6+
7+
use Illuminate\Http\Request;
8+
9+
class {{ class }}ClassController extends ClassController
10+
{
11+
12+
protected $inheritedClass = '{{ class }}';
13+
14+
/**
15+
* Get the class parameters. This method is used to get the class parameters for the class instance. Remove if not needed.
16+
*
17+
* @return iterable an iterable of parameters to be used in the class constructor, or an empty array if no parameters are needed
18+
*/
19+
protected function classParameters(): iterable
20+
{
21+
return [];
22+
}
23+
24+
/**
25+
* Additional setup in the constructor for the current $this->class(). If you need to do additional operations on the class to set it up, you should over-write this method and do your own logic here. Remove if not needed.
26+
*
27+
* @return void
28+
*/
29+
protected function postClassSetup(): void
30+
{
31+
//
32+
}
33+
34+
}

0 commit comments

Comments
 (0)