Kaziux
2 months ago
323
3
Nova

Method Illuminate\Validation\Validator::validateRequird does not exist, when using BelongsToManyField field

Posted 2 months ago by Kaziux

When I'm using Benjacho https://novapackages.com/packages/benjacho/belongs-to-many-field belongstomanyfield and try insert data. I get Method Illuminate\Validation\Validator::validateRequird does not exist. I assume is spelling mistake of package field validation. Source code:

<?php

namespace App\Nova;

use Illuminate\Http\Request;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\BelongsToMany;
use Benjacho\BelongsToManyField\BelongsToManyField;
use Laravel\Nova\Fields\BelongsTo;
use Laravel\Nova\Fields\Select;
use Laravel\Nova\Fields\Number;
use Laravel\Nova\Fields\Date;
use Spatie\TagsField\Tags;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Fields\Textarea;

public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),

            BelongsTo::make('Brand', 'brand', 'App\Nova\Brand'),
            Text::make('Name', 'name')->rules('required'),

            Textarea::make('Description', 'description')->rules('required'),
            
            Textarea::make('Search tags', 'search_tags')->rules('required'),

            Number::make('Priority', 'priority')->min(1)->max(10)->rules('required'),
            Select::make('Time frame', 'time_frame')->options([
                'Next Month' => 'Next Month',
                'Next 3 Months' => 'Next 3 Months',
                'Next 6 Months' => 'Next 6 Months',
                'Next 12 Months' => 'Next 12 Months',
            ])->rules('required'),
            Select::make('Successive meassure', 'success_measure')->options([
                'New Unique Visitors' => 'New Unique Visitors',
                'Beverages Sold' => 'Beverages Sold',
                'New Unique Customers' => 'New Unique Customers',
            ])->rules('required'),
            BelongsToManyField::make('Objective Owner', 'user', 'App\Nova\User')->relationModel(\App\Objectives::class)->rules('required'),
            Date::make('Review date', 'review_date')->rules('requird'),
            Select::make('Status', 'status')->options([
                'Proposed' => 'Proposed',
                'Active' => 'Active',
                'Achieved' => 'Achieved'
            ])->rules('required'),


        ];
    }

Please sign in or create an account to participate in this conversation.