Open Grayda opened 5 years ago
Hmm... the pastebin doesn't help, can you share your implementation? I really can't debug anything without code. Thanks
I'm off from work until the 21st of January, so I can't test this code and I'm flying a little blind here (I've only got a zip of my source and no environment to test with), but here's the basic steps I took:
php artisan nova:resource Tag
(probably not necessary, but eh)php artisan nova:action SetTags
<?php
namespace App\Nova\Actions;
use Illuminate\Bus\Queueable;
use Laravel\Nova\Actions\Action;
use Illuminate\Support\Collection;
use Laravel\Nova\Fields\ActionFields;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use PalauaAndSons\TagsField\Tags;
class SetTags extends Action
{
use InteractsWithQueue, Queueable, SerializesModels;
/**
* Perform the action on the given models.
*
* @param \Laravel\Nova\Fields\ActionFields $fields
* @param \Illuminate\Support\Collection $models
* @return mixed
*/
public function handle(ActionFields $fields, Collection $models)
{
foreach($models as $model) {
$model->setTags($fields->tags);
}
}
/**
* Get the fields available on the action.
*
* @return array
*/
public function fields()
{
return [
Tags::make('Tags')
];
}
}
SetTags
action.And this is where I'm flying blind. The two possible scenarios are:
class@anonymous
error message as a toast
OR I hope this helps!
When I add the tag field to an action, I get the following error:
And here's a pastebin of the error from my logs: https://pastebin.com/gefkfDU5
I'd assume this field could be used on actions as well, but any help or suggestions are appreciated :)