Add support for dedicated eloquent builders and type/doc parameter support. (#1089)

* Add support for generating helpers for external eloquent builders

* Extract external builder methods generator to its own method and add an option to toggle this feature

* Check if we are using the default name of the eloquent builder

* Add tests with snapshots for external eloquent builder feature

* Refactor codegs

* Allow for type hinting

* Update test

* Run cs fix

* Update readme

* Use getName for parameter instead of relying on __toString()

* Do not use str_contains and use built in php method
This commit is contained in:
Kaloqn
2020-12-04 07:36:08 +01:00
committed by GitHub
parent b3a79fe6c1
commit db53e8e2b5
11 changed files with 631 additions and 2 deletions
@@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Models;
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
public function newEloquentBuilder($query): PostExternalQueryBuilder
{
return new PostExternalQueryBuilder($query);
}
}