fix: rename ModelFinder to MorphModelFinder

BE.model-finder
farid saravi 4 years ago
parent 18bd18ddc6
commit f9facdab68

@ -2,7 +2,7 @@
namespace App\Console\Commands;
use App\Services\ModelFinder;
use App\Services\MorphModelFinder;
use Illuminate\Console\Command;
class CacheMorphMap extends Command
@ -22,20 +22,20 @@ class CacheMorphMap extends Command
protected $description = 'Create a cache file for faster morph mapping';
/**
* @var ModelFinder
* @var MorphModelFinder
*/
private $modelFinder;
private $morphModelFinder;
/**
* Create a new command instance.
*
* @param ModelFinder $modelFinder
* @param MorphModelFinder $morphModelFinder
*/
public function __construct(ModelFinder $modelFinder)
public function __construct(MorphModelFinder $morphModelFinder)
{
parent::__construct();
$this->modelFinder = $modelFinder;
$this->morphModelFinder = $morphModelFinder;
}
/**
@ -45,10 +45,10 @@ class CacheMorphMap extends Command
*/
public function handle(): void
{
$cache = $this->modelFinder->getCachePath();
$cache = $this->morphModelFinder->getCachePath();
$models = $this->modelFinder->getModels();
$map = $this->modelFinder->getModelMap($models);
$models = $this->morphModelFinder->getModels();
$map = $this->morphModelFinder->getModelMap($models);
file_put_contents(
$cache,

@ -2,7 +2,7 @@
namespace App\Console\Commands;
use App\Services\ModelFinder;
use App\Services\MorphModelFinder;
use Illuminate\Console\Command;
class ClearCachedMorphMap extends Command
@ -22,20 +22,20 @@ class ClearCachedMorphMap extends Command
protected $description = 'Remove the morph map cache file';
/**
* @var ModelFinder
* @var MorphModelFinder
*/
private $modelFinder;
private $morphModelFinder;
/**
* Create a new command instance.
*
* @param ModelFinder $modelFinder
* @param MorphModelFinder $morphModelFinder
*/
public function __construct(ModelFinder $modelFinder)
public function __construct(MorphModelFinder $morphModelFinder)
{
parent::__construct();
$this->modelFinder = $modelFinder;
$this->morphModelFinder = $morphModelFinder;
}
/**
@ -45,7 +45,7 @@ class ClearCachedMorphMap extends Command
*/
public function handle(): void
{
@unlink($this->modelFinder->getCachePath());
@unlink($this->morphModelFinder->getCachePath());
$this->info('Morph map models cache cleared!');
}

@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Relation;
class ModelFinder
class MorphModelFinder
{
/**
* Scan all model directories and automatically alias the polymorphic types of Eloquent models.
Loading…
Cancel
Save