Skip to content

Commit 1cadf92

Browse files
authored
Merge pull request #657 from Laravel-Backpack/fix-dummy-crud
Fix dummy crud
2 parents 6259f89 + 7da6df7 commit 1cadf92

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

app/Http/Controllers/Admin/DummyCrudController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ protected function setupCreateOperation()
6868

6969
foreach ($this->groups() as $groupKey => $groupFields) {
7070
CRUD::addField([
71-
'name' => $groupKey,
72-
'label' => str_replace('_', ' ', Str::title($groupKey)),
73-
'type' => 'repeatable',
74-
'fake' => true,
75-
'store_in' => 'extras',
76-
'fields' => $groupFields,
71+
'name' => $groupKey,
72+
'label' => str_replace('_', ' ', Str::title($groupKey)),
73+
'type' => 'repeatable',
74+
'fake' => true,
75+
'store_in' => 'extras',
76+
'subfields' => $groupFields,
7777
]);
7878
}
7979
}

app/Models/Dummy.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ public function articles()
7676
return $this->belongsToMany(\Backpack\NewsCRUD\app\Models\Article::class, 'monster_article', 'monster_id', 'article_id');
7777
}
7878

79+
public function categorySelect2()
80+
{
81+
return $this->belongsTo(\Backpack\NewsCRUD\app\Models\Category::class, 'select2');
82+
}
83+
7984
/*
8085
|--------------------------------------------------------------------------
8186
| SCOPES

0 commit comments

Comments
 (0)