platform icon indicating copy to clipboard operation
platform copied to clipboard

15.0 dev new select

Open bald-cat opened this issue 1 year ago • 0 comments

Proposed Changes

  • Added new Select field. The field combines the functionality of the Select field and the Relation field
  • The method of sending a request to the controller has been changed from passing the model name to passing the model itself along with the builder.

Now work:

  • fromEnum - moved from the old field
  • fromModel - can now accept model name or query builder
  • added lazy() method
  • added QuerySerializer class

Need to do:

  • clean the controller - DONE
  • add support for older versions in search - DONE
  • transfer various small methods like empty(), taggable() and other - DONE
  • decide whether you need two methods chunk() and lazy() or combine them into one - DONE
  • enum support in controller - DONE
  • change FormRequest - DONE

Example:

Select2::make('users_test')
  ->multiple()
  ->displayAppend('full')
  ->searchColumns('email')
  ->fromModel(
      model: User::where('id', '>', 5)
          ->where('email', '!=', '[email protected]')
          ->has('orders'),
      name: 'name',
      key: 'email',
      chunk: 20,
  )
  ->title('Select2 for Eloquent model'),
                       

bald-cat avatar Feb 28 '25 13:02 bald-cat