zaster
1 year ago

List with a selected item

Posted 1 year ago by zaster

I am in the process of writing the code for this, but couldn't get it right yet.

I need to edit the company list but the old selected item should be already selected

                    @foreach ($companies as $company)
                       <option @if( $company->id == old('company_id',$company->id)) selected @endif >
                          {{ $company->company_name }}
                       <option>
                    @endforeach

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