Nwidart\Modules\Repository::findOrFail PHP Method

findOrFail() public method

Find a specific module, if there return that, otherwise throw exception.
public findOrFail ( $name ) : Module
$name
return Module
    public function findOrFail($name)
    {
        $module = $this->find($name);
        if ($module !== null) {
            return $module;
        }
        throw new ModuleNotFoundException("Module [{$name}] does not exist!");
    }

Usage Example

Esempio n. 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $this->module = $this->laravel['modules'];
     $name = $this->argument('module');
     if ($name) {
         $module = $this->module->findOrFail($name);
         return $this->migrate($module);
     }
     foreach ($this->module->getOrdered($this->option('direction')) as $module) {
         $this->line('Running for module: <info>' . $module->getName() . '</info>');
         $this->migrate($module);
     }
 }
All Usage Examples Of Nwidart\Modules\Repository::findOrFail