Skip to content

Commit

Permalink
Added ClassController stub
Browse files Browse the repository at this point in the history
  • Loading branch information
mwargan committed Jul 13, 2022
1 parent 9b6998a commit 14122c7
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ClassControllerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ public function boot()

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

// Publish the stubs
$this->publishes([
__DIR__ . '/../stubs' => base_path('stubs'),
], 'stubs');

// Publishing the views.
/*$this->publishes([
__DIR__.'/../resources/views' => resource_path('views/vendor/classcontroller'),
Expand All @@ -50,7 +55,7 @@ public function boot()
public function register()
{
// Automatically apply the package configuration
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'classcontroller');
$this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'classcontroller');

// Register the main class to use with the facade
$this->app->singleton('classcontroller', function () {
Expand Down
34 changes: 34 additions & 0 deletions stubs/controller.class.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace {{ namespace }};

use MMedia\ClassController\Http\Controllers\ClassController;

use Illuminate\Http\Request;

class {{ class }}ClassController extends ClassController
{

protected $inheritedClass = '{{ class }}';

/**
* Get the class parameters. This method is used to get the class parameters for the class instance. Remove if not needed.
*
* @return iterable an iterable of parameters to be used in the class constructor, or an empty array if no parameters are needed
*/
protected function classParameters(): iterable
{
return [];
}

/**
* 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.
*
* @return void
*/
protected function postClassSetup(): void
{
//
}

}

0 comments on commit 14122c7

Please sign in to comment.