Skip to content

Commit

Permalink
Merge pull request #3 from DrudgeRajen/patch
Browse files Browse the repository at this point in the history
patch issue
  • Loading branch information
DrudgeRajen authored Dec 19, 2018
2 parents 8cd6f47 + 3dd1bb5 commit 15c871e
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/ContentManager/ContentGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ public function formatContent($array, $indexed = true)
public function getDeleteStatement($dataType): string
{
$delete = <<<'TXT'
\$dataType = DataType::find('10');
$dataType = DataType::find('10');
if (is_bread_translatable(\$dataType)) {
\$dataType->deleteAttributeTranslations(\$dataType->getTranslatableAttributes());
if (is_bread_translatable($dataType)) {
$dataType->deleteAttributeTranslations($dataType->getTranslatableAttributes());
}
if (\$dataType) {
\$dataType->destroy(10);
if ($dataType) {
$dataType->destroy(10);
}
TXT;

Expand All @@ -90,10 +90,10 @@ public function getDeleteStatement($dataType): string
public function generateMenuDeleteStatements($dataType) : string
{
$menuDelete = <<<'TXT'
\$menuItem = MenuItem::where('route', 'voyager.\$dataType->slug.index');
$menuItem = MenuItem::where('route', 'voyager.$dataType->slug.index');
if (\$menuItem->exists()) {
\$menuItem->delete();
if ($menuItem->exists()) {
$menuItem->delete();
}
TXT;

Expand All @@ -111,12 +111,12 @@ public function generateMenuDeleteStatements($dataType) : string
public function getPermissionStatement($dataType, $type = null) : string
{
$permission = <<<'TXT'
Voyager::model('Permission')->generateFor(\$dataType->name);
Voyager::model('Permission')->generateFor($dataType->name);
TXT;

if (! is_null($type)) {
$permission = <<<'TXT'
Voyager::model('Permission')->removeFrom(\$dataType->name);
Voyager::model('Permission')->removeFrom($dataType->name);
TXT;
}

Expand All @@ -132,24 +132,24 @@ public function getPermissionStatement($dataType, $type = null) : string
public function getMenuInsertStatements($dataType) : string
{
$menu = <<<'TXT'
\$menu = Menu::where('name', config('voyager.bread.default_menu'))->firstOrFail();
$menu = Menu::where('name', config('voyager.bread.default_menu'))->firstOrFail();
\$menuItem = MenuItem::firstOrNew([
'menu_id' => \$menu->id,
$menuItem = MenuItem::firstOrNew([
'menu_id' => $menu->id,
'title' => 'Credit Cards',
'url' => '',
'route' => 'voyager.credit-cards.index',
]);
\$order = Voyager::model('MenuItem')->highestOrderMenuItem();
$order = Voyager::model('MenuItem')->highestOrderMenuItem();
if (!\$menuItem->exists) {
\$menuItem->fill([
if (!$menuItem->exists) {
$menuItem->fill([
'target' => '_self',
'icon_class' => '',
'color' => null,
'parent_id' => null,
'order' => \$order,
'order' => $order,
])->save();
}
TXT;
Expand Down

0 comments on commit 15c871e

Please sign in to comment.