Skip to content

Commit

Permalink
fixed form field issue while adding new record
Browse files Browse the repository at this point in the history
Signed-off-by: Ritesh Singh <1124ritesh@gmail.com>
  • Loading branch information
riteshsingh1 committed Aug 5, 2021
1 parent e7fac2f commit c6d4554
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "imritesh/livecrud",
"description": "Generate Basic Crud Operations With Livewire and Tailwind Css For Laravel",
"license": "MIT",
"version": "v2.3.0",
"version": "v2.3.1",
"authors": [
{
"name": "Ritesh Singh",
Expand Down
6 changes: 3 additions & 3 deletions src/Commands/LiveCrudView.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function getRenderedData()
$columns = $model->getFillable();
$str = '';
$c = 1;
$str .= '@foreach($rows as $row)' . PHP_EOL;
$str .= '@forelse($rows as $row)' . PHP_EOL;
$str .= '<tr>';
if (config('livecrud.template') == 'tailwind') {
foreach ($columns as $column) {
Expand All @@ -115,7 +115,7 @@ public function getRenderedData()
<a href="#" class="text-indigo-600 hover:text-indigo-900" wire:click="edit({{ $row->id }})">{{ __("Edit") }}</a>
<a href="#" class="text-indigo-600 hover:text-indigo-900" wire:click="confirmDelete({{ $row->id }})">{{ __("Delete") }}</a>
</td></tr>';
$str .= '@endforeach' . PHP_EOL;
$str .= '@empty <tr><td>No Records Found</td></tr> @endforelse' . PHP_EOL;

}
if (config('livecrud.template') == 'bootstrap') {
Expand All @@ -140,7 +140,7 @@ public function getRenderedData()
<path fill-rule="evenodd" d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z" clip-rule="evenodd" />
</svg></a>
</td></tr>';
$str .= '@endforeach' . PHP_EOL;
$str .= '@empty <tr><td>No Records Found</td></tr> @endforelse' . PHP_EOL;

}
return $str;
Expand Down
1 change: 1 addition & 0 deletions src/stubs/bootstrap.crud.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class {{ name }} extends Component
public function create ()
{
$this->mode = 'create';
$this->resetForm();
$this->showForm = true;

$this->emit("showForm");
Expand Down
1 change: 1 addition & 0 deletions src/stubs/crud.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class {{ name }} extends Component
public function create ()
{
$this->mode = 'create';
$this->resetForm();
$this->showForm = true;
}

Expand Down

0 comments on commit c6d4554

Please sign in to comment.