Skip to content

Commit 09263e6

Browse files
committed
Fixed Relationship field type bug.
Added control to have different prefix'es for homepage and functions.
1 parent 3ba3245 commit 09263e6

File tree

6 files changed

+10
-8
lines changed

6 files changed

+10
-8
lines changed

src/Builders/RequestBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ private function buildRules($type)
106106
} elseif ($field->type == 'relationship') {
107107
switch ($field->validation) {
108108
case 'required':
109-
$rules .= "'" . $field->relationship_name . "_" . $field->relationship_field . "' => '$field->validation', \r\n ";
109+
$rules .= "'" . $field->relationship_name . "_id' => '$field->validation', \r\n ";
110110
break;
111111
case 'required|unique':
112112
$camelName = Str::camel($this->name);
113113
// Insert table names
114114
$tableName = strtolower($camelName);
115-
$rules .= "'" . $field->relationship_name . "_" . $field->relationship_field . "' => '$field->validation:$tableName,$field->title,'." . '$this->' . $this->request . ", \r\n ";
115+
$rules .= "'" . $field->relationship_name . "_id' => '$field->validation:$tableName,$field->relationship_name_id,'." . '$this->' . $this->request . ", \r\n ";
116116
break;
117117
}
118118
} elseif ($field->type == 'file') {

src/Config/quickadmin.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@
1515
*/
1616
// Default route
1717
'route' => 'admin',
18+
// Default home route
19+
'homeRoute' => 'admin',
1820

1921
];

src/Controllers/publish/PasswordController

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class PasswordController extends Controller
2929
*/
3030
public function __construct()
3131
{
32-
$this->redirectTo = config('quickadmin.route');
32+
$this->redirectTo = config('quickadmin.homeRoute');
3333
$this->middleware('guest');
3434
}
3535
}

src/Views/admin/partials/sidebar.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
data-slide-speed="200">
77
@if(Auth::user()->role_id == 1)
88
<li @if(Request::path() == 'crud') class="active" @endif>
9-
<a href="{{ url('crud') }}">
9+
<a href="{{ url(config('quickadmin.route').'/crud') }}">
1010
<i class="fa fa-plus"></i>
1111
<span class="title">Crud</span>
1212
</a>

src/Views/admin/partials/topbar.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="page-header-inner">
33
<div class="page-header-inner">
44
<div class="navbar-header">
5-
<a href="{{ url(config('quickadmin.route')) }}" class="navbar-brand">
5+
<a href="{{ url(config('quickadmin.homeRoute')) }}" class="navbar-brand">
66
QuickAdmin
77
</a>
88
</div>

src/routes.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
'middleware' => 'auth'
2929
], function () {
3030
// Dashboard home page route
31-
Route::get(config('quickadmin.route'), 'QuickadminController@index');
32-
Route::get('crud', 'QuickadminCrudController@create');
33-
Route::post('crud', 'QuickadminCrudController@insert');
31+
Route::get(config('quickadmin.homeRoute'), 'QuickadminController@index');
32+
Route::get(config('quickadmin.route') . '/crud', 'QuickadminCrudController@create');
33+
Route::post(config('quickadmin.route') . '/crud', 'QuickadminCrudController@insert');
3434
});
3535

3636
// @todo move to default routes.php

0 commit comments

Comments
 (0)