¨4.0.1¨
This commit is contained in:
@@ -18,14 +18,16 @@ class EntityGenerator extends Generator
|
||||
'views/shortcuts.stub' => 'Resources/views/admin/$ENTITY_NAME$/partials/shortcuts.blade.php',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Generate the given entities.
|
||||
*
|
||||
* @param array $entities
|
||||
* @param bool $generateSidebar
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function generate(array $entities, $generateSidebar = true)
|
||||
public function generate(array $entities, $generateSidebar = true): void
|
||||
{
|
||||
if (count($entities) !== 0 && $generateSidebar) {
|
||||
$this->generateSidebarExtender($entities);
|
||||
@@ -44,11 +46,13 @@ class EntityGenerator extends Generator
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a filled sidebar view composer
|
||||
* Or an empty one of no entities.
|
||||
*
|
||||
* @param $entities
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function generateSidebarExtender($entities)
|
||||
@@ -59,10 +63,12 @@ class EntityGenerator extends Generator
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Append permissions.
|
||||
*
|
||||
* @param string $entity
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function appendPermissions($entity)
|
||||
@@ -75,10 +81,12 @@ class EntityGenerator extends Generator
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate migrations file for eloquent entities.
|
||||
*
|
||||
* @param string $entity
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function generateMigrations($entity)
|
||||
@@ -99,6 +107,7 @@ class EntityGenerator extends Generator
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the current time with microseconds.
|
||||
*
|
||||
@@ -114,10 +123,12 @@ class EntityGenerator extends Generator
|
||||
return $date->format('Y_m_d_Hisu_');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate entity.
|
||||
*
|
||||
* @param string $entity
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function generateEntity($entity)
|
||||
@@ -133,10 +144,12 @@ class EntityGenerator extends Generator
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate the controller for the given entity.
|
||||
*
|
||||
* @param string $entity
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function generateController($entity)
|
||||
@@ -149,10 +162,12 @@ class EntityGenerator extends Generator
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate the requests for the given entity.
|
||||
*
|
||||
* @param string $entity
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function generateRequests($entity)
|
||||
@@ -165,32 +180,12 @@ class EntityGenerator extends Generator
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate views for the given entity.
|
||||
*
|
||||
* @param string $entity
|
||||
* @return void
|
||||
*/
|
||||
private function generateViews($entity)
|
||||
{
|
||||
$entityName = snake_case(str_plural($entity));
|
||||
|
||||
$this->createDirectory("Resources/views/admin/{$entityName}/partials");
|
||||
|
||||
foreach ($this->views as $stub => $view) {
|
||||
$view = str_replace('$ENTITY_NAME$', $entityName, $view);
|
||||
|
||||
$this->finder->put(
|
||||
$this->getModulesPath($view),
|
||||
$this->getContentForStub($stub, $entity)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate language files for the given entity.
|
||||
*
|
||||
* @param string $entity
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function generateLang($entity)
|
||||
@@ -215,10 +210,36 @@ class EntityGenerator extends Generator
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate views for the given entity.
|
||||
*
|
||||
* @param string $entity
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function generateViews($entity)
|
||||
{
|
||||
$entityName = snake_case(str_plural($entity));
|
||||
|
||||
$this->createDirectory("Resources/views/admin/{$entityName}/partials");
|
||||
|
||||
foreach ($this->views as $stub => $view) {
|
||||
$view = str_replace('$ENTITY_NAME$', $entityName, $view);
|
||||
|
||||
$this->finder->put(
|
||||
$this->getModulesPath($view),
|
||||
$this->getContentForStub($stub, $entity)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Append the routes for the given entity to the routes file.
|
||||
*
|
||||
* @param string $entity
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function appendRoutes($entity)
|
||||
@@ -231,10 +252,12 @@ class EntityGenerator extends Generator
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Append sidebar extender.
|
||||
*
|
||||
* @param string $entity
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function appendSidebarExtender($entity)
|
||||
|
||||
Reference in New Issue
Block a user