小编Bou*_*mad的帖子

搜索多个字段laravel的最佳方式

我尝试使用 8 个字段创建一个搜索函数。我在底部使用这种方式,但它返回任何报价都具有此给定值之一。我想要的是他拥有所有价值的报价。用户可以在他想要的任何字段中搜索什么是最好的方法,而没有很多条件,如果

 public function search(Request $request)
        {
            $hashids = new Hashids();
            $city = $request->city;
            $category = $request->category;
            $type = $request->type;
            $rooms = $request->rooms;
            $minPrice = $request->minPrice;
            $maxPrice = $request->maxPrice;
            $minSpace = $request->minSpace;
            $maxSpace = $request->maxSpace;
            $citySearch = DB::table('offers')->where('city',$city);
            $categorySearch = DB::table('offers')->where('category_id',$category);
            $typeSearch = DB::table('offers')->where('type',$type);
            $roomsSearch = DB::table('offers')->where('rooms',$rooms);
            $priceSearch = DB::table('offers')
                ->whereBetween('price', [$minPrice, $maxPrice]);
            $spaceSearch = DB::table('offers')
                ->whereBetween('space', [$minSpace, $maxSpace]);
            $result_search = $citySearch->union($categorySearch)->union($typeSearch)->union($roomsSearch)->union($priceSearch)->union($spaceSearch)->get();
            $view = View::make('ajax.search',compact('result_search','hashids'))->render();
            return response()->json(['html'=>$view]);
        }
Run Code Online (Sandbox Code Playgroud)

php ajax laravel

4
推荐指数
1
解决办法
2273
查看次数

使用ajax更改事件对象后如何刷新fullcalendar v4

我使用 fullcalendar v4 来显示事件。事件正常显示在加载中,但我需要使用多个复选框添加过滤器,并在使用 ajax 更改复选框后刷新 fullcalendar 事件。

更改后我得到新的对象事件,但我需要刷新我尝试calendar.render();但不工作的fullcalendar

fullcalendar V4 !!
Run Code Online (Sandbox Code Playgroud)

全日历脚本

 var taskEvents = JSON.parse($("input[name=tasks_events]").val());
        var calendarEl = document.getElementById('tasks_calendar');
        var  calendar = new FullCalendar.Calendar(calendarEl, {
            locale: 'fr',
            plugins: [ 'interaction', 'dayGrid', 'timeGrid' ],
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'dayGridMonth,timeGridWeek'
            },
            defaultDate: new Date(),
            defaultView: 'timeGridWeek',
            minTime: "09:00:00",
            maxTime: "20:00:00",
            weekends:false,
            businessHours: true, // display business hours
            editable: true,
            selectable: true,
            droppable: true,
            //events:taskEvents ,
            select: function(info) {
                $('#newTaskFormLabel').html('Commence à '+"<b> " + moment(info.startStr).format('DD-MM-YYYY …
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery fullcalendar fullcalendar-4

3
推荐指数
1
解决办法
1万
查看次数

表单和输入未显示在引导程序弹出窗口中

我想在 Bootstrap 弹出窗口中创建一个表单。弹出窗口显示所有元素,但当我使用form标签或等时inputbutton它不会显示任何内容。

\n\n

\r\n
\r\n
var options = {\r\n  content: function() {\r\n    return $("#message_popover_content").html();\r\n  },\r\n  html: true,\r\n  container: "body",\r\n  placement: \'bottom\',\r\n};\r\n\r\n$(\'#message_popover\').popover(options);
Run Code Online (Sandbox Code Playgroud)\r\n
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js" integrity="sha384-6khuMg9gaYr5AxOqhkVIODVIvm9ynTT5J4V1cfthmT+emCG6yVmEZsRHdxlotUnm" crossorigin="anonymous"></script>\r\n<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">\r\n<a href="javascript:void(0)" id="message_popover" class="sm-btn-success border-default mt-2 ml-4" rel="popover">Envoyer une autre version</a>\r\n<div id="message_popover_content" class="d-none">\r\n  <div class="popover-cart">\r\n    <div class="popover-head">\r\n      <h3 class="s-m-title">Envoyer une nouvelle version de l\xe2\x80\x99EVP (juillet 19)</h3>\r\n    </div>\r\n    <div class="popover-body">\r\n      <div class="send-msg-form add-formation-modal">\r\n        <form action="javascript:void(0)">\r\n          <div class="form-group">\r\n            <textarea class="form-control" name="message" rows="3"></textarea>\r\n          </div>\r\n          <div class="form-group">\r\n …
Run Code Online (Sandbox Code Playgroud)

jquery popover bootstrap-4

2
推荐指数
1
解决办法
982
查看次数