小编mos*_*toh的帖子

如何在laravel 5中显示最后一个查询?

我用 :

DB::connection()->enableQueryLog();
var_dump(DB::getQueryLog());
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

我的服务是这样的:

public function dataCustomerList($param) 
    {
        $status = $param['status_sort'];
        $gender = $param['gender'];
        $published = $param['published'];

        if($published=='NO'){
            $published_check = 'NO';
            $published = 0;
        }
        else if($published=='YES'){
            $published_check = 'YES';
            $published = 1;
        }
 DB::connection()->enableQueryLog();
        $customer = customer::paginate(10);

        if(!empty($status)) {
            // die($status);
            $customer = customer::where('tb_customer.customer_status', '=', $status)->paginate(10);
        }

        if (!empty($gender)) {
            $customer = customer::where('tb_customer.gender', '=', $gender)->paginate(10);
        }

        if (!empty($published_check)) {
            $customer = customer::where('tb_customer.published', '=', $published)->paginate(10);
        }
        var_dump(DB::getQueryLog());
        return $customer;


    }   
Run Code Online (Sandbox Code Playgroud)

当我运行它时,查询不会出现

结果是这样的:

array(0) {
}
Run Code Online (Sandbox Code Playgroud)

如何在Laravel 5中执行查询?

非常感谢你

laravel laravel-5

5
推荐指数
0
解决办法
1604
查看次数

如何调整Bootstrap DatePicker的大小?

我的代码是这样的:

HTML:

<div class="input-append date datepicker no-padding" data-date-format="dd-mm-yyyy">
    <input class="input-medium" size="16" type="text"><span class="add-on"><i class="icon-th"></i></span>
</div>
Run Code Online (Sandbox Code Playgroud)

Javascript:

$(document).ready(function() {
    $('.datepicker').datepicker({
        autoclose: true,
        startDate: new Date()
    });
});
Run Code Online (Sandbox Code Playgroud)

演示:jsfiddle

我想改变bootstrap datepicker的大小

任何解决我的问题的建议

谢谢

css jquery datepicker twitter-bootstrap

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

如何在 CodeIgniter 中实现 Redis?

我得到了教程:

http://yaminnoor.com/redis-codeigniter/

https://codeigniter.com/user_guide/libraries/caching.html#redis

我像这样尝试:

配置 ( application\config\redis.php):

defined('BASEPATH') OR exit('No direct script access allowed');

$config['socket_type'] = 'tcp'; //`tcp` or `unix`
$config['socket'] = '/var/run/redis.sock'; // in case of `unix` socket type
$config['host'] = '127.0.0.1'; //change this to match your amazon redis cluster node endpoint
$config['password'] = NULL;
$config['port'] = 6379;
$config['timeout'] = 0;
Run Code Online (Sandbox Code Playgroud)

控制器:

<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Redis_tes extends CI_Controller {
    public function __construct() {
        parent::__construct();

        $this->load->driver('cache', array('adapter' => 'redis', 'backup' => …
Run Code Online (Sandbox Code Playgroud)

php codeigniter redis

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

如何在卡组bootstrap vue上设置行列?

我的 vue 组件是这样的:

<template>
  ...
    <b-card-group deck deck v-for="row in formattedClubs">
        <b-card  v-for="club in row"
                :title="club.description"
                img-src="http://placehold.it/130?text=No-image"
                img-alt="Img"
                img-top>
            <p class="card-text">
                {{club.price}}
            </p>
            <p class="card-text">
                {{club.country}}
            </p>
            <div slot="footer">
                <b-btn variant="primary" block>Add</b-btn>
            </div>
        </b-card>
    </b-card-group>
  ...
</template>

<script>
export default {
  data: function () {
    return {
      clubs: [
          {id:1, description:'chelsea', price:1000, country:'england'},
          {id:2, description:'liverpool', price:900, country:'england'},
          {id:3, description:'mu', price:800, country:'england'},
          {id:4, description:'cit', price:700, country:'england'},
          {id:5, description:'arsenal', price:600, country:'england'},
          {id:6, description:'tottenham', price:500, country:'england'},
          {id:7, description:'juventus', price:400, country:'italy'},
          {id:8, description:'madrid', price:300, …
Run Code Online (Sandbox Code Playgroud)

twitter-bootstrap vue.js bootstrap-4 vue-component vuejs2

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

如何知道 reCAPTCHA v3 是否有效?

我的前端使用 vuetify 如下:

   validate: async function () {
    let tokenCaptcha
    await this.$recaptcha('login').then((token) => {
      tokenCaptcha = token
    })

    if (this.$refs.form.validate() && tokenCaptcha) {
        let params = {
          birthDate: this.birthday,
          emailAddress: this.email,
          name: this.fullname,
          phoneNumber: this.phone,
          recaptcha: tokenCaptcha
        }
        this.modalSummary = true
        await this.setSummary(params) // Async vuex store / post to api backend
        if (this.dataSummary) {
          this.success = true
        } else {
          this.success = false
        }
    }
  }
Run Code Online (Sandbox Code Playgroud)

参考: https: //www.npmjs.com/package/vue-recaptcha-v3

我的后端/服务器端使用express js(node js),如下所示:

app.post('/summary', function (req, res) {
    if (req.body.recaptcha …
Run Code Online (Sandbox Code Playgroud)

captcha node.js express vue.js vuetify.js

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

使用 jQuery DataTables 更改列顺序

我的代码是这样的:http : //jsfiddle.net/oscar11/ebRXw/805/

$(document).ready(function() {
    var table = $('#example').DataTable( {
        "responsive": true
    } );
} );
Run Code Online (Sandbox Code Playgroud)

我的例子中

  • 第 0 列 = 名称
  • 第 1 列 = 位置
  • 第 2 列 = 办公室

我想在不更改 HTML 的情况下将其更改为这样:

  • 第 0 列 = 薪水
  • 第 1 列 = 开始日期
  • 第 2 列 = 年龄

jquery datatables

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

如何在select2中添加图标?

我使用select2版本4

我试着这样:

$("select02").select2({
    placeholder: "<i class='fa fa-sitemap'></i>Branch name",
});
Run Code Online (Sandbox Code Playgroud)

但是,它不起作用

演示是这样的:http://jsfiddle.net/fc1qevem/8/

解决我的问题的任何解决方案?

html javascript css jquery jquery-select2

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

如何解决未捕获的ReferenceError:未定义总线?(vue.js 2)

我遵循本教程:https://vuejs.org/v2/guide/components.html#Non-Parent-Child-Communication

它将数据从组件传递到其他组件

请参阅下面的情况.我试着这样

我的观点是这样的:

<div class="row">
    <div class="col-md-3">
        <search-filter-view ...></search-filter-view>
    </div>
    <div class="col-md-9">
        <search-result-view ...></search-result-view>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我的search-filter-view组件是这样的:

<script>
    export default{
        props:[...],
        data(){
            return{
                ...
            }
        },
        methods:{
            filterBySort: function (sort){
                bus.$emit('sort-param', sort)
                this.sort = sort
                ...
            }
        }
    }
</script>
Run Code Online (Sandbox Code Playgroud)

我的搜索结果视图组件是这样的:

<script>
    export default {
        props:[...],
        data() {
            return {
                ...
            }
        },

        methods: {
            getVueItems: function(page) {
                bus.$on('sort-param', function (sort) {
                    console.log(sort);
                })
                ...
            }
        }
    }
</script>
Run Code Online (Sandbox Code Playgroud)

我添加var bus = new Vue();了\ …

javascript vue.js vue-component vuex vuejs2

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

vue 上模态关闭时如何运行语句?

我的 vue 组件是这样的:

<template>
    ...
    <b-modal ref="modal" id="modalInvoice" size="lg"  title="Invoice">
        <Invoice/>
        <div slot="modal-footer" class="w-100"> 
            <b-btn size="sm" class="float-right" variant="warning" @click="show=false">
                <i class="fa fa-print"></i> Print
            </b-btn>
        </div>
    </b-modal>

    ...
        <b-btn variant="warning" class="btn-square mt-2" v-b-modal.modalInvoice @click="checkout()"><i class="fa fa-credit-card-alt"></i>Checkout</b-btn>
    ...
</template>
<script>
    ...
    export default {
        ...
        mounted() {
            $(this.$refs.modal).on('hidden.bs.modal', () => {
                console.log('close modal')
            })
        },
    }
</script>
Run Code Online (Sandbox Code Playgroud)

我这样尝试。所以我尝试使用ref="modal"并安装。但它不起作用。如果模式关闭,console.log 不会显示

我怎么解决这个问题?

javascript bootstrap-modal vue.js vue-component vuejs2

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

如果在 datepicker vuetify 中选择日期,如何调用方法?

我的代码笔是这样的:https://codepen.io/positivethinking639/pen/mddejJN

我的代码是这样的:

<div id="app">
  <v-app>
    <v-content>
    <v-container>
      <v-dialog
        ref="dialogTest"
        v-model="modalTest"
        :return-value.sync="dateTest"
        persistent
      >
        <template v-slot:activator="{ on }">
          <v-btn color="success" dark v-on="on">call date</v-btn>
        </template>
        <div class="text-center title">Select a Date & Time</div>
        <v-row justify="center">
        <v-date-picker v-model="dateTest" scrollable :allowed-dates="allowedDates">
          <div class="flex-grow-1"></div>
          <v-btn text color="primary" @click="modalTest = false">Cancel</v-btn>
          <v-btn text color="primary" @click="saveData">OK</v-btn>

        </v-date-picker>
        <v-slide-y-transition>
            <v-col cols=2 v-show="dateTest !== null">
              <template v-for="allowedTime in allowedTimes">
                <v-btn
                  @click="setTime(allowedTime)"
                  class="my-2"
                  :outlined="allowedTime !== time"
                  block
                  x-large
                  color="primary"
                >{{ allowedTime }}</v-btn>
              </template>
            </v-col>
          </v-slide-y-transition>
          </row>
      </v-dialog>

    {{dateTest}}
  </v-container>
  </v-content> …
Run Code Online (Sandbox Code Playgroud)

datepicker vue.js vue-component vuejs2 vuetify.js

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