Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stub 'generator' for command 'make:addon'.
- Loading branch information
Showing
29 changed files
with
1,476 additions
and
192 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
namespace {$namespace}\Providers; | ||
|
||
class AddonServiceProvider extends \Illuminate\Support\ServiceProvider | ||
{ | ||
/** | ||
* Register the service provider. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
if (!$this->app->isLocal()) { | ||
return; | ||
} | ||
|
||
$files = $this->app['files']; | ||
$stub_directory = addon_config(addon_name(), 'commands.stub.directory'); | ||
|
||
$routine = function ($instance, $app) use ($stub_directory) { | ||
$instance->setStubDirectory($stub_directory); | ||
return $instance; | ||
}; | ||
|
||
if (addon_config(addon_name(), 'commands.stub.overrides')) { | ||
if ($files->exists('console.stub')) { | ||
$this->app->extend('command.console.make', $routine); | ||
} | ||
if ($files->exists('controller.stub')) { | ||
$this->app->extend('command.controller.make', $routine); | ||
} | ||
if ($files->exists('event.stub')) { | ||
$this->app->extend('command.event.make', $routine); | ||
} | ||
if ($files->exists('job.stub')) { | ||
$this->app->extend('command.job.make', $routine); | ||
} | ||
if ($files->exists('listener.stub')) { | ||
$this->app->extend('command.listener.make', $routine); | ||
} | ||
if ($files->exists('middleware.stub')) { | ||
$this->app->extend('command.middleware.make', $routine); | ||
} | ||
if ($files->exists('migration.stub')) { | ||
$this->app->extend('command.migration.make', $routine); | ||
} | ||
if ($files->exists('model.stub')) { | ||
$this->app->extend('command.model.make', $routine); | ||
} | ||
if ($files->exists('policy.stub')) { | ||
$this->app->extend('command.policy.make', $routine); | ||
} | ||
if ($files->exists('provider.stub')) { | ||
$this->app->extend('command.provider.make', $routine); | ||
} | ||
if ($files->exists('request.stub')) { | ||
$this->app->extend('command.request.make', $routine); | ||
} | ||
if ($files->exists('seeder.stub')) { | ||
$this->app->extend('command.seeder.make', $routine); | ||
} | ||
if ($files->exists('test.stub')) { | ||
$this->app->extend('command.test.make', $routine); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Bootstrap the application events. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
return [ | ||
'stub' => [ | ||
'directory' => __DIR__.'/../stubs', | ||
|
||
'overrides' => true, | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace {$namespace}; | ||
|
||
use Illuminate\Console\Command; | ||
|
||
/** | ||
* Custom class | ||
*/ | ||
class {$class} extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = '{$command}'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Command description.'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
// | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
sources/Addons/stubs/generator/stubs/_controller-resource.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
|
||
namespace {$namespace}; | ||
|
||
use {$root_namespace}\Http\Controllers\Controller as BaseController; | ||
use Illuminate\Http\Request; | ||
use {$root_namespace}\Http\Requests; | ||
|
||
/** | ||
* Custom class | ||
*/ | ||
class {$class} extends BaseController | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function index() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Show the form for creating a new resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function create() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function store(Request $request) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Display the specified resource. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function show($id) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Show the form for editing the specified resource. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function edit($id) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function update(Request $request, $id) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Remove the specified resource from storage. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function destroy($id) | ||
{ | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace {$namespace}; | ||
|
||
use {$root_namespace}\Events\Event; | ||
use Illuminate\Queue\SerializesModels; | ||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast; | ||
|
||
/** | ||
* Custom class | ||
*/ | ||
class {$class} extends Event | ||
{ | ||
use SerializesModels; | ||
|
||
/** | ||
* Create a new event instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Get the channels the event should be broadcast on. | ||
* | ||
* @return array | ||
*/ | ||
public function broadcastOn() | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace {$namespace}; | ||
|
||
use {$root_namespace}\Jobs\Job; | ||
use Illuminate\Queue\SerializesModels; | ||
use Illuminate\Queue\InteractsWithQueue; | ||
use Illuminate\Contracts\Bus\SelfHandling; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
|
||
/** | ||
* Custom class | ||
*/ | ||
class {$class} extends Job implements SelfHandling, ShouldQueue | ||
{ | ||
use InteractsWithQueue, SerializesModels; | ||
|
||
/** | ||
* Create a new job instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Execute the job. | ||
* | ||
* @return void | ||
*/ | ||
public function handle() | ||
{ | ||
// | ||
} | ||
} |
Oops, something went wrong.