-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Description
Describe the bug
I created a batch action with form input. When I submit the form I am getting this error
OpenAdmin\Admin\Form::model(): Return value must be of type Illuminate\Database\Eloquent\Model, OpenAdmin\Admin\Actions\Interactor\Form returned {"userId":1,"exception":"[object] (TypeError(code: 0): OpenAdmin\\Admin\\Form::model(): Return value must be of type Illuminate\\Database\\Eloquent\\Model, OpenAdmin\\Admin\\Actions\\Interactor\\Form returned at /var/www/html/vendor/open-admin-org/open-admin/src/Form.php:188)
To Reproduce
Here is my Batch Action
<?php
namespace App\Admin\Actions\PO;
use App\Models\PO\PurchasedItems;
use OpenAdmin\Admin\Actions\BatchAction;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Request;
class SetWareHouse extends BatchAction
{
protected $selector = '.report-pages';
public function handle(Collection $collection, Request $request)
{
foreach ($collection as $model) {
if ($model instanceof PurchasedItems) {
$model->storage_location = $request->input("storage_location");
$model->save();
}
}
return $this->response()->success('Report submitted!')->refresh();
}
public function form()
{
$this->text('storage_location', 'storage_location')->rules('required');
}
public function html()
{
return "<a class='report-pages btn btn-sm btn-danger show-on-rows-selected d-none me-1'><i class='icon-info-circle'></i>Set Store</a>";
}
}
System
Metadata
Metadata
Assignees
Labels
No labels
