Skip to content

Commit

Permalink
Update stubs for generators (#63)
Browse files Browse the repository at this point in the history
Allow for triple generators - user custom, boilerplate, falling back to laravel
  • Loading branch information
specialtactics authored Apr 28, 2023
1 parent 1815c11 commit 470d444
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 319 deletions.
64 changes: 0 additions & 64 deletions resources/stubs/controller.api.stub

This file was deleted.

16 changes: 6 additions & 10 deletions resources/stubs/controller.model.stub
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
<?php

namespace DummyNamespace;
namespace {{ namespace }};

use Illuminate\Http\Request;
use DummyFullModelClass;
use {{ rootNamespace }}Transformers\BaseTransformer;
use {{ namespacedModel }};

class DummyClass extends Controller
class {{ class }} extends Controller
{
/**
* @var BaseModel The primary model associated with this controller
* @var {{ model }} The primary model associated with this controller
*/
public static $model = DummyModelClass::class;

/**
* @var BaseModel The parent model of the model, in the case of a child rest controller
*/
public static $parentModel = null;
public static $model = {{ model }}::class;

/**
* @var null|BaseTransformer The transformer this controller should use, if overriding the model & default
Expand Down
89 changes: 10 additions & 79 deletions resources/stubs/controller.nested.stub
Original file line number Diff line number Diff line change
@@ -1,94 +1,25 @@
<?php

namespace DummyNamespace;
namespace {{ namespace }};

use DummyFullModelClass;
use ParentDummyFullModelClass;
use Illuminate\Http\Request;
use DummyRootNamespaceHttp\Controllers\Controller;
use {{ rootNamespace }}Transformers\BaseTransformer;
use {{ namespacedModel }};

class DummyClass extends Controller
class {{ class }} extends Controller
{
/**
* Display a listing of the resource.
*
* @param \ParentDummyFullModelClass $ParentDummyModelVariable
* @return \Illuminate\Http\Response
* @var {{ model }} The primary model associated with this controller
*/
public function index(ParentDummyModelClass $ParentDummyModelVariable)
{
//
}
public static $model = {{ model }}::class;

/**
* Show the form for creating a new resource.
*
* @param \ParentDummyFullModelClass $ParentDummyModelVariable
* @return \Illuminate\Http\Response
* @var {{ parentModel }} The parent model of the model, in the case of a child rest controller
*/
public function create(ParentDummyModelClass $ParentDummyModelVariable)
{
//
}
public static $parentModel = {{ parentModel }}::class;

/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \ParentDummyFullModelClass $ParentDummyModelVariable
* @return \Illuminate\Http\Response
* @var null|BaseTransformer The transformer this controller should use, if overriding the model & default
*/
public function store(Request $request, ParentDummyModelClass $ParentDummyModelVariable)
{
//
}

/**
* Display the specified resource.
*
* @param \ParentDummyFullModelClass $ParentDummyModelVariable
* @param \DummyFullModelClass $DummyModelVariable
* @return \Illuminate\Http\Response
*/
public function show(ParentDummyModelClass $ParentDummyModelVariable, DummyModelClass $DummyModelVariable)
{
//
}

/**
* Show the form for editing the specified resource.
*
* @param \ParentDummyFullModelClass $ParentDummyModelVariable
* @param \DummyFullModelClass $DummyModelVariable
* @return \Illuminate\Http\Response
*/
public function edit(ParentDummyModelClass $ParentDummyModelVariable, DummyModelClass $DummyModelVariable)
{
//
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \ParentDummyFullModelClass $ParentDummyModelVariable
* @param \DummyFullModelClass $DummyModelVariable
* @return \Illuminate\Http\Response
*/
public function update(Request $request, ParentDummyModelClass $ParentDummyModelVariable, DummyModelClass $DummyModelVariable)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param \ParentDummyFullModelClass $ParentDummyModelVariable
* @param \DummyFullModelClass $DummyModelVariable
* @return \Illuminate\Http\Response
*/
public function destroy(ParentDummyModelClass $ParentDummyModelVariable, DummyModelClass $DummyModelVariable)
{
//
}
public static $transformer = null;
}
17 changes: 6 additions & 11 deletions resources/stubs/controller.plain.stub
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<?php

namespace DummyNamespace;
namespace {{ namespace }};

use Illuminate\Http\Request;
use App\Transformers\BaseTransformer;
use App\Models\BaseModel;
use {{ rootNamespace }}Transformers\BaseTransformer;
use {{ namespacedModel }};

class DummyClass extends Controller
class {{ class }} extends Controller
{
/**
* @var BaseModel The primary model associated with this controller
* @var {{ model }} The primary model associated with this controller
*/
public static $model = BaseModel::class;

/**
* @var BaseModel The parent model of the model, in the case of a child rest controller
*/
public static $parentModel = null;
public static $model = {{ model }}::class;

/**
* @var null|BaseTransformer The transformer this controller should use, if overriding the model & default
Expand Down
85 changes: 0 additions & 85 deletions resources/stubs/controller.stub

This file was deleted.

7 changes: 5 additions & 2 deletions resources/stubs/model.stub
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?php

namespace DummyNamespace;
namespace {{ namespace }};

use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Transformers\BaseTransformer;

class DummyClass extends BaseModel
class {{ class }} extends BaseModel
{
use HasFactory;

/**
* @var string UUID key of the resource
*/
Expand Down
10 changes: 0 additions & 10 deletions resources/stubs/pivot.model.stub

This file was deleted.

18 changes: 0 additions & 18 deletions resources/stubs/policy.plain.stub

This file was deleted.

Loading

0 comments on commit 470d444

Please sign in to comment.