In laravel 10 app using stubs I have problem with first letter of a class as having in stubs/controller.plain.stub file classes which must be used in different format like "Class", "class", "CLASS",
I tried to use
Str::ucfirst
method :
namespace {{ namespace }};
use {{ rootNamespace }}Http\Controllers\Controller;
use App\Http\Requests\Create{{ Str::ucfirst(class) }}Request;
use App\Http\Requests\Update{{ Str::ucfirst(class) }}Request;
use App\Http\Resources\{{ Str::ucfirst(class) }}Resource;
use App\Repositories\{{ Str::ucfirst(class) }}CrudRepository;
use App\Repositories\Interfaces\DBTransactionInterface;
class {{ class }}Controller extends Controller
{
protected ${{ class }}CrudRepository;
protected $dbTransaction;
public function __construct({{ Str::ucfirst(class) }}CrudRepository ${{ class }}CrudRepository, DBTransactionInterface $dbTransaction)
{
$this->{{ class }}CrudRepository = ${{ class }}CrudRepository;
$this->dbTransaction = $dbTransaction;
}
But with command :
php artisan make:controller --type=plain ProductController
Different file I need :
<?php
namespace App\Http\Controllers;
use App\Http\Requests\Create{{ Str::ucfirst(class) }}Request;
use App\Http\Requests\Update{{ Str::ucfirst(class) }}Request;
use App\Http\Resources\{{ Str::ucfirst(class) }}Resource;
use App\Library\AppCustomException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use App\Repositories\{{ Str::ucfirst(class) }}CrudRepository;
use App\Repositories\Interfaces\DBTransactionInterface;
class ProductControllerController extends Controller
{
protected $ProductControllerCrudRepository;
protected $dbTransaction;
public function __construct({{ Str::ucfirst(class) }}CrudRepository $ProductControllerCrudRepository, DBTransactionInterface $dbTransaction)
{
$this->ProductControllerCrudRepository = $ProductControllerCrudRepository;
$this->dbTransaction = $dbTransaction;
}
Str::ucfirst(class)
was not replaced and sure I need
ProductController
but not :
ProductControllerController
If there is a way to tune it someway?