-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined property $tags when using in an action #3
Comments
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
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')
];
}
}
And this is where I'm flying blind. The two possible scenarios are:
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 :)
The text was updated successfully, but these errors were encountered: