小编Sar*_* TS的帖子

如何在Vue.js中添加bootstrap工具提示

我有一个页面,用于使用Vue.js和Laravel列出表中的数据.上市数据是成功的.删除和编辑功能正在进行中.为此,我增加了两个<span> (glyphicon-pencil), <span> (glyphicon-trash).如果两者<span>都在<template>工具提示显示之外,否则它不起作用.你知道引导工具提示在Vue Js中是如何工作的吗?谢谢.

page.blade.php

    <template id="tasks-template">
       <table class="table table-responsive table-bordered table-hover">
            <thead>
                   <tr>
                   <th>#</th>
                   <th>Id</th>
                   <th>Religion</th>
                   <th>Action</th>
                   <th>Created</th>
                   <td>Status</td>
               </tr>
           </thead>

      <tbody>
             <tr v-for="(index, task) in list">
             <td><input type="checkbox" id="checkbox" aria-label="checkbox" value="checkbox"></td>
             <td>@{{ index + 1 }}</td>
            <td>@{{ task.religion | capitalize }}</td>
           <td v-if="task.status == 'publish'">
                     <span class="glyphicon glyphicon-ok"></span>
           </td>
           <td v-else>
                     <span class="glyphicon glyphicon-remove"></span>
           </td>
           <td>@{{ task.created_at }}</td>
           <td>
               <span class="glyphicon glyphicon-pencil" aria-hidden="true" data-toggle="tooltip" data-placement="left" title="Edit"></span> 
               <span class="glyphicon glyphicon-trash" aria-hidden="true" data-toggle="tooltip" …
Run Code Online (Sandbox Code Playgroud)

twitter-bootstrap laravel vue.js

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

Mongo groupby在Laravel raw方法中没有使用不同的时间

下面的代码是从mongoDB获取数据,并在图表中使用日期范围绘制金额和日期的总和(sum(prepayment_amount) and sum(total_prepayment_amount) group by checkin_from date).金额总和在y axis,日期是x axis.

从这段代码我得到金额和日期的总和,但问题是,

看日期和时间2017-10-05T19:07:17Z & 2017-10-05T00:00:00Z.在这种情况下(sum(prepayment_amount)sum(total_prepayment_amount)日期分别绘制.

如果日期和时间是2017-10-05T00:07:17Z & 2017-10-05T00:00:00Z.我得到了正确的结果.

我不知道问题出在哪里.我添加了例外结果.任何帮助,将不胜感激.谢谢

Booking.php(型号)

protected $dates = ['bookingdate', 'checkin_from', 'reserve_to'];
Run Code Online (Sandbox Code Playgroud)

DashbardController.php

public function show(Request $request)
    {
        if(!empty($request->cabin) && !empty($request->daterange))
        {
            $cabinName              = $request->cabin;
            $daterange              = explode("-", $request->daterange);
            /*$dateBegin              = new \MongoDB\BSON\UTCDateTime(strtotime($daterange[0])*1000);
            $dateEnd                = new \MongoDB\BSON\UTCDateTime(strtotime($daterange[1])*1000);*/
            $dateBegin              = new \MongoDB\BSON\UTCDateTime(new DateTime($daterange[0]));
            $dateEnd                = new \MongoDB\BSON\UTCDateTime(new DateTime($daterange[1]));
            $bookings               = Booking::raw(function ($collection) use ($cabinName, $dateBegin, …
Run Code Online (Sandbox Code Playgroud)

php mongodb laravel laravel-5 laravel-5.4

25
推荐指数
1
解决办法
693
查看次数

如何使用php将mysql数据导出到xml中

下面的代码是从mysql表导出数据作为xml文件.我尝试了几个代码,但没有得到结果.请检查并帮助我.

目前得到的结果是

8sarathsarathernakulam423432washington9rahulrahulernakulam21212121newyork10aaaa3london11bbbb1newyork12cccc2washington13dddd3london
Run Code Online (Sandbox Code Playgroud)

<?php
require_once "classes/dbconnection-class.php";
if(isset($_POST['export'])){
    header('Content-type: text/xml');
    $xml          = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    $root_element = "addressbook"; //fruits
    $xml         .= "<$root_element>";
    $query        = "SELECT AB.id, AB.name, AB.firstname, AB.street, AB.zipcode, AB.city_id, CI.city FROM address_book AS AB INNER JOIN city AS CI ON AB.city_id = CI.id";
    $result      = $mysqli->query($query);
    if (!$result) {
        die('Invalid query: ' . $mysqli->error());
    }

    while($result_array = $result->fetch_assoc()){
        $xml .= "<address>";
        foreach($result_array as $key => $value)
        {
            //$key holds the table column name
            $xml .= "<$key>";

            //embed the …
Run Code Online (Sandbox Code Playgroud)

php php-5.3 php-5.6 php-5.5

10
推荐指数
1
解决办法
2469
查看次数

Laravel HTML到PDF转换(DOMPDF)

用于Laravel 5的DOMPDF包装器,它是用于laravel 5的html到pdf转换器.

我试图将laravel默认auth注册页面转换为PDF,路径为http://www.careertag.dev/auth/register.用于此目的的代码如下.但是我遇到了字体问题.你能帮我解决这个问题吗?

routes.php文件

Route::post('/screenshot', function(){
    $pdf  =  App::make('dompdf.wrapper');
    //$pdf->loadHTML('<h1>Test</h1>');
    $view =  View::make('auth.register')->render();
    $pdf->loadHTML($view);
    $pdf->stream();
    //return $pdf->stream('invoice');
    return $pdf->download('profile.pdf');
});
Run Code Online (Sandbox Code Playgroud)

错误

ErrorException in font_metrics.cls.php line 343: file_put_contents(C:\xampp\htdocs\careertag\storage\fonts/13350985545a9988387f8a573f409063.ttf): failed to open stream: No such file or directory
Run Code Online (Sandbox Code Playgroud)

php dompdf laravel laravel-5

7
推荐指数
1
解决办法
5747
查看次数

当客户使用Payone钱包方法付款时,有些预订有问题(paypal)

我已成功实施Payone支付网关(Creditcard,Sofort,Paydirect和Paypal).成功付款后,我得到了回应(指定和支付),一切都很好.但有时我在客户支付使用后没有得到Payone的回复Paypal(我检查了大约60次成功的交易.但是在2或3次交易中没有得到回应而且客户的金额已从他们的账户中扣除).

成功交易后,payone将数据发布到此路线

/* Response from payone */
    Route::post('/payment/response', 'PaymentController@response')->name('payment.response');
Run Code Online (Sandbox Code Playgroud)

我认为laravel请求不是从url捕获数据.或使用此方法有问题Schema::hasColumn.

任何帮助将不胜感激.

PaymentController.php

public function response(Request $request)
{
  // Here I created to store all request in to table but data is not storing.
  /* Testing purpose begin */

   $payment        = new Payment;

   foreach($_POST as $key => $value) {
     if(Schema::hasColumn($payment->getTable(), $key)){
        if(is_array($value)) {
           $payment->{$key} = $value[1];
        } else {
                $payment->{$key} = $value;
                }
      }
    }
    $payment->save();

  /* Testing purpose end */

  if ($_POST["key"] == hash("md5", env('KEY'))) { …
Run Code Online (Sandbox Code Playgroud)

php paypal laravel payone

7
推荐指数
1
解决办法
178
查看次数

在https服务器中我们需要配置什么才能实现实时通知模块(使用redis和socket.io)?

我在本地计算机上完成了一个成功的实时通知模块.我需要在live server中实现这个模块.实时服务器是https.我不知道我们需要为https更改哪些内容.请检查我的代码并帮助将其集成到https服务器上.谢谢.

ssl文件

SSLCertificateFile /etc/letsencrypt/live/dev.test.de/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/dev.test.de/privkey.pem
Run Code Online (Sandbox Code Playgroud)

socket.js

var app   = require('express')();
var http  = require('http').Server(app);
var io    = require('socket.io')(http);
var redis = require('redis');

io.on('connection', function(socket){
    console.log('a user connected');

    var redisClient = redis.createClient();

    /* Realtime message subscribe */
    redisClient.subscribe('message');
    redisClient.on('message', function(channel, message){
        /*console.log('new message in queue', channel, message);*/
        socket.emit(channel, message);
    });

    /* Realtime inquiry subscribe */
    redisClient.subscribe('inquiryCount');
    redisClient.on('inquiryCount', function(channel, message){
        /*console.log('new inquiry in queue', channel, message);*/
        socket.emit(channel, message);
    });

    socket.on('disconnect', function(){
        redisClient.quit();
        console.log('user disconnected');
    });
});


http.listen(3000, function(){
    console.log('listening on …
Run Code Online (Sandbox Code Playgroud)

php sockets laravel laravel-5 laravel-5.4

6
推荐指数
1
解决办法
233
查看次数

我们如何在PHP中分割日期?

我们如何使用PHP分割日期?PHP中是否有内置函数?

2016-11-01 10:00:00 till 2016-11-03 18:00:00
Run Code Online (Sandbox Code Playgroud)

我需要将上述日期分成所需日期: -

2016-11-01 10:00:00 till 23:59:59
2016-11-02 00:00:00 till 23:59:59
2016-11-03 00:00:00 till 18:00:00
Run Code Online (Sandbox Code Playgroud)

php

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

Laravel 独特的电子邮件验证不适用于 mongodb 中的不同字符大小写

我有一个带有唯一电子邮件验证的注册表。当我输入不同的字符大小写时,电子邮件不会应用唯一验证。

example@gmail.com, Example@gmail.com, eXample@gmail.com: Laravel 唯一验证失败。

example@gmail.com, example@gmail.com, example@gmail.com: Laravel 唯一验证是成功的。

请检查我下面的代码并纠正我。电子邮件在数据库中以小写形式存储。

DB-Mongodb,

框架 - Laravel 5.5

jenssegers/laravel-mongodb 用于连接 laravel 和 mongodb

注册控制器.php

protected function validator(array $data)
{
  return Validator::make($data, [
     'firstName' => 'required|string|max:255',
     'lastName' => 'required|string|max:255',
     'email' => 'required|string|email|max:255|unique:user,usrEmail',
     'password' => 'required|string|min:6|confirmed',
  ]);
}
Run Code Online (Sandbox Code Playgroud)

User.php(模型)

public function setusrEmailAttribute($value)
{
  $this->attributes['usrEmail'] = strtolower($value);
}
Run Code Online (Sandbox Code Playgroud)

php laravel-5 laravel-5.5

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

在引导日期选择器更改月份事件不起作用

我的网站上有一个预订可用性检查部分。我用过bootstrap datepicker

首次加载页面时,我正在使用jquery ajax和php从数据库中获取一些日期,以禁用datepicker日历上的日期。所以,我用了setDatesDisabled。在第一次加载日期选择器时,它工作正常。

当我更改月份时,我得到json响应,但datepicker上的日期未禁用。我已经尝试了changeMonth事件,但是没有用。请帮我解决这个问题

杰森回应

disableDates:["13.01.2018", "20.01.2018", "27.01.2018"]

$("#dateFrom").datepicker({
                autoclose: true,
                todayHighlight: true,
                format: 'dd.mm.yy',
                startDate: new Date()
            }).on('show', function(e) {
                $.ajax({
                    url: '/cabinowner/bookings/availability',
                    dataType: 'JSON',
                    type: 'POST'
                })
                    .done(function( response ) {
                        $("#dateFrom").datepicker('setDatesDisabled', response.disableDates);
                    })
                    .fail(function(response, jqxhr, textStatus, error) {
                    });
            });

            $("#dateFrom").datepicker().on('changeMonth', function(e) {
                $.ajax({
                    url: '/cabinowner/bookings/availability',
                    dataType: 'JSON',
                    type: 'POST',
                    data: { date : moment(e.date).format('YY-MM-DD') }
                })
                    .done(function( response ) {
                        // here response is getting but next month is …
Run Code Online (Sandbox Code Playgroud)

javascript jquery datepicker bootstrap-datepicker

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

如何从laravel 5.5的内部存储文件夹中获取文件?

我需要从 storage->app->public->huetten-> 它包含 17 个文件夹中列出文件。每个文件夹都包含图像。任何帮助,将不胜感激。

public function show($id)
    {
        if(!empty($id)) {
            $directories = Storage::disk('public')->allDirectories('huetten');
            foreach ($directories as $directory) {
                //dd($directory); // Here i get huetten/folder1

                $files = Storage::files($directory);
                foreach ($files as $file) {
                    dd($file); // But here files are not listing
                }


            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

php laravel-5 laravel-5.5

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

使用Laravel和VueJs对ajax数据进行排序和过滤

当前代码使用vue.js对数据进行排序和过滤.它工作正常,但数据是虚拟的,它是硬编码的.我需要使用vue js和laravel从表中动态获取数据.如何获取动态数据gridData

JS

Vue.component('demo-grid', {
    template: '#grid-template',
    props: {
        data: Array,
        columns: Array,
        filterKey: String
    },
    data: function () {
        var sortOrders = {}
        this.columns.forEach(function (key) {
            sortOrders[key] = 1
        })
        return {
            sortKey: '',
            sortOrders: sortOrders
        }
    },
    methods: {
        sortBy: function (key) {
            this.sortKey = key
            this.sortOrders[key] = this.sortOrders[key] * -1
        }
    }
})

// bootstrap the demo
var demo = new Vue({
    el: '#app',
    data: {
        searchQuery: '',
        gridColumns: ['name', 'power'],
        gridData: [
            { name: …
Run Code Online (Sandbox Code Playgroud)

laravel vue.js

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

分页如何在api系统中工作(前端是angular2,后端是laravel5.4)?

我有一个酒店预订项目,使用angular2创建前端,使用laravel创建后端,这是一个API系统。我在angular2中有一张表。为此,我从laravel获取了预订数据,并将其绑定在角度表中,但是我不知道分页如何通过api工作。最初,我仅获取并绑定了15个数据。当我们单击下一页时,如何访问更多数据。这是laravel angular的代码。

拉拉韦尔

public function index()
{
   $bookings = Booking::where('is_delete', 0)
            ->paginate(15);

   return response()->json(['bookingDetails' => $bookings], 200);
}
Run Code Online (Sandbox Code Playgroud)

角度2

booking.service.ts

import { Injectable } from '@angular/core';
import { Headers, Http, Response } from '@angular/http';

import { Bookings } from './booking';

import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/map';
import 'rxjs/Rx';
import { Observable } from "rxjs";

@Injectable()
export class BookingService {
    private headers = new Headers({'Content-Type': 'application/json'});
    private _url: string = 'http://cabinapi.app/api/bookings/';
    /*private _url: string = 'apidata/testData.json';*/
    constructor(private http: Http) { }

    getBooking(): Observable<any> …
Run Code Online (Sandbox Code Playgroud)

laravel-5 angular2-services laravel-5.4 angular

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

按回车键停止页面刷新

我正在使用谷歌 API 进行几何定位。目前,当我输入地址自动完成工作并鼠标单击 div 中的纬度和经度时。我的问题是,如果我按 Enter 键而不是单击鼠标,页面将刷新。实际上不要在从自动完成中选择数据并输入时刷新页面。请检查下面的代码并帮助我解决问题。

<html>
    <head>
    <title>Place Autocomplete With Latitude & Longitude </title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <style>
#pac-input {
    background-color: #fff;
    padding: 0 11px 0 13px;
    width: 400px;
    font-family: Roboto;
    font-size: 15px;
    font-weight: 300;
    text-overflow: ellipsis;
}
#pac-input:focus {
    border-color: #4d90fe;
    margin-left: -1px;
    padding-left: 14px;  /* Regular padding-left + 1. */
    width: 401px;
}
}
</style>
    </head>
    <body>
        <form method="POST" action="#">
            <input id="pac-input" class="controls" type="text" placeholder="Enter a location">
            <div id="lat"></div>
            <div id="long"></div>
            <button type="submit" …
Run Code Online (Sandbox Code Playgroud)

javascript php jquery google-maps geo

0
推荐指数
1
解决办法
4342
查看次数