I faced not exactly this problem, but that I am not able to depend on selected value with NovaDependencyContainer (probably because on the input there is no id set. Hope it will be fixed
Steps to reproduce:
Create migration:
Schema::create('test_subjects', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name', 128);
});
Create model.
Create action:
namespace App\Nova\Actions;
use App\Models\TestSubject;
use Epartment\NovaDependencyContainer\NovaDependencyContainer;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Collection;
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Fields\ActionFields;
use Laravel\Nova\Fields\Select;
use Laravel\Nova\Fields\Text;
use Techouse\SelectAutoComplete\SelectAutoComplete;
class AttachTestsQuestionsToTest extends Action
{
use InteractsWithQueue, Queueable;
public function handle(ActionFields $fields, Collection $models)
{
dump($fields);
dd($models);
}
public function fields()
{
return [
SelectAutoComplete::make('Test Subject2', 'test_subject2')
->options(
$subjects->mapWithKeys(
fn(TestSubject $subject) => [$subject->id => "({$subject->id}) {$subject->name}"]
)
)
->displayUsingLabels(),
NovaDependencyContainer::make(
[
Text::make('second when test_subject is 3')
]
)->dependsOn('test_subject2', 3),
];
}
}
On the screenshots below you can see the problem:
I faced not exactly this problem, but that I am not able to depend on selected value with
NovaDependencyContainer
(probably because on the input there is no id set. Hope it will be fixedSteps to reproduce:
Create migration:
Create model.
Create action: