-
-
Notifications
You must be signed in to change notification settings - Fork 839
Open
Labels
Description
Hi, I like the generation of code, but have some opinions. Correct me if something wrong.
- Requests:
Scaffolding creating 2 separate files for Update and Create in Model.
There is no difference as i see. My advice to make one request file. For update rules i write something like.
public function rules() {
$rules = [
'name' => 'required|unique:cars',
'car_type_id' => 'required',
'max_pax' => 'required',
];
if ($this->route('car')){
$rules['name'] = [
'required',
Rule::unique('cars')->ignore($this->route('car'))];
}
return $rules;
}
And i delete rules from model and write logic in request itself.
- BaseRepository.
Did not find anything related with eager loading. added code. I think it is used mostly.
// Get with eager loading
public function with($with)
{
$query = $this->model->newQuery()->with($with);
return $query->get();
}
- Generating blade templates:
There are too much code repeat in some blades(create,edit,show)
Better to make create_layout, edit_layout etc and pass params from some json file?
Anyway thank you for great package and your effort.
RayhanYulanda