Skip to content

Commit

Permalink
feat: to view for form and table
Browse files Browse the repository at this point in the history
  • Loading branch information
ah-rahimi committed Nov 6, 2023
1 parent 8db72ba commit fcb7336
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/Controllers/Makers/FormMaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,17 @@ public function reset(string $label = 'شروع دوباره', string $color = '
return $this;
}

protected function beforeRender()
/** return the view of the form */
public function toView()
{
$this->data['view'] = view('panel::form.index', [
return view('panel::form.index', [
'form' => (object)$this->form,
'groups' => $this->groups,
]);
}

protected function beforeRender()
{
$this->data['view'] = $this->toView();
}
}
12 changes: 9 additions & 3 deletions src/Controllers/Makers/TableMaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,20 @@ public function setPrimaryKey(string $key): TableMaker
return $this;
}

protected function beforeRender()
/** return the view of the table */
public function toView()
{
$this->data->put('view', view('panel::table', [
return view('panel::table', [
'headers' => $this->headers->toArray(),
'actions' => $this->actions?->toArray(),
'rows' => $this->rows,
'primaryKey' => $this->primaryKey,
'paginate' => $this->paginate,
]));
]);
}

protected function beforeRender()
{
$this->data->put('view', $this->toView());
}
}

0 comments on commit fcb7336

Please sign in to comment.