I want to make the list of table who have relation only, example:
Table:
- Order
- Process
In ProcessCrudController I want to replace the Process list view into Order list view that only have relation (order-process).
The solution I've tried:
- Create new function in OrderCrudController
return view($this->crud->getListView(), $this->data);
- then,
addClause
using$request->type
URL
The problem of that solution:
- Not showing the action row in table
- Easy to show all query if we try to remove URL
I really want to make the list view of Process that only already have relation to Order, or any suggestion/idea to make this happen?
NB: I'm struggling at this problem I didn't found the solution, help me please
EDIT (Adding Code):
OrderCrudController:
protected function setupListOperation()
{
// This is the solution that I described before
// $request = request();
// $this->crud->addClause('where', 'user_id', '=', $request->type ?? 1);
$this->crud->addColumns([
[
'name' => 'personal_name',
'label' => 'Name',
'type' => 'text',
],
[
'name' => 'notes',
'label' => 'Catatan',
'type' => 'textarea',
],
[
'name' => 'user_id',
'label' => 'Dibuat oleh',
'type' => 'select',
'entity' => 'user',
'attribute' => 'name',
'model' => 'App\User',
],
]);
}
ProcessCrudController:
protected function setupListOperation()
{
CRUD::setFromDb();
// This table should be listing Order's query and that only have a process (already created custom_create_view)
// That's why i want to take Order's table and not making new custom_list_view
}