Skip to content

Commit 50b86e2

Browse files
committed
Issue #4 fix.
Changed the initial title of the fake crud `Users` to `User`. Faking `users` table call in our CrudController.
1 parent 8dba2d0 commit 50b86e2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Commands/QuickAdminInstall.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ public function createUser()
9696
public function copyMasterTemplate()
9797
{
9898
Crud::create([
99-
'name' => 'Users',
100-
'title' => 'Users',
99+
'name' => 'User',
100+
'title' => 'User',
101101
'is_crud' => 0
102102
]);
103103
$this->callSilent('vendor:publish', [

src/Controllers/QuickadminCrudController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ public function create()
3131
// Get columns for relationship
3232
$models = [];
3333
foreach (Crud::all() as $crud) {
34-
$tableName = strtolower($crud->name);
34+
// We are having a default User model
35+
if ($crud->title == 'User' && $crud->is_crud == 0) {
36+
$tableName = 'users';
37+
} else {
38+
$tableName = strtolower($crud->name);
39+
}
3540
$models[$crud->id] = Schema::getColumnListing($tableName);
3641
}
3742

0 commit comments

Comments
 (0)