*
* @var string
*/
- protected $signature = 'cubist:magic:precache';
+ protected $signature = 'cubist:magic:precache {--force}';
public function handle()
{
- $this->_handleMagicFolder([$this, '_precacheForce']);
- $this->_handleMagicFolder([$this, '_precache']);
+ $force = $this->option('force');
+ if ($force) {
+ $this->_handleMagicFolder([$this, '_precacheForce']);
+ } else {
+ $this->_handleMagicFolder([$this, '_precache']);
+ }
}
/**
namespace Cubist\Backpack\Jobs;
+use Illuminate\Support\Facades\Artisan;
+
class ModelsPrecache extends Base
{
+ /**
+ * @var bool
+ */
+ protected $force = false;
+
+ /**
+ * @param bool $force
+ */
+ public function setForce(bool $force): void
+ {
+ $this->force = $force;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isForce(): bool
+ {
+ return $this->force;
+ }
+ public function handle()
+ {
+ $args = [];
+ if ($this->isForce()) {
+ $args['--force'] = true;
+ }
+ Artisan::call('cubist:magic:precache', $args);
+ }
}