简体   繁体   中英

Laravel Backpack filter range amount input width too small

I add a filter range from backpack.

在此处输入图像描述

But the input for the min and max is too small, I want to set the width. How do I set it? This is my Code.

$this->crud->addFilter([ // daterange filter
    'type' => 'date_range',
    'name' => 'from_to',
    'label' => 'Date',
], false, function ($value) { // if the filter is active, apply these constraints
    $dates = json_decode($value);
    $this->crud->addClause('where', 'created_at', '>=', $dates->from);
    $this->crud->addClause('where', 'created_at', '<=', $dates->to.' 23:59:59');
});

There is no way to change the width of the inputs there. But you can easily create a new filter, starting from this one, which is wider, and use that one. You just need to:

  1. run php artisan backpack:publish crud/filters/range . This will copy-paste the file in your resources/views/vendor/backpack/crud/filters/range.blade.php .
  2. Go to that published file and rename it to wide_range.blade.php . Then change the css/html inside it to fit your needs.
  3. Change your controller to use the wide_range filter instead of range .

Then you'll have a range filter as wide as you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM