Rabeedmenam
1 week ago
193
19
Laravel

Undefined index

Posted 1 week ago by Rabeedmenam

why the below function returned Undefined index: abbr!?

*Get_Default_language(); = get local language from App

    public function store(MainCategoryRequest $request)
    {
        $MainCategory = collect($request->category);

        $Filter = $MainCategory->filter(function ($value,$key){

        return $value['abbr'] == Get_Default_language();
      });
       return  array_values($Filter->all());


    }

form

 <div class="col-md-6">
  <div class="form-group"> <label for="projectinput1"> Abbr -{{$lang->abbr}}</label>
 <input type="text" value="" id="name" class="form-control" placeholder="Please Enter the Abbr Name" name="category[{{$index}}][abbr]">

 @error("category.$index.abbr")
   <span class="text-danger">Required abbr</span>
  @enderror
    </div>
  </div>

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