小编The*_*Guy的帖子

Vue JS每x秒触发一次方法/函数

标题几乎可以解释它,但是我希望每秒触发一个函数。

我没有尝试过任何东西,也没有太多有用的代码。

我已经进行了一些谷歌搜索,到目前为止,我对任何示例都不满意。

另外,我正在使用laravel 5.6

这对于调用countDown()方法不起作用

export default {
    ready() {
        window.setInterval(() => {
            this.countDown();
        },1000);
    },
Run Code Online (Sandbox Code Playgroud)

vuejs2 laravel-5.6

10
推荐指数
3
解决办法
6135
查看次数

使用Laravel 5.4从条带中检索订阅计划列表

如何从Laravel 5.4获取条带订阅计划列表?

有没有办法检索订阅计划列表?

以下检查用户是否订阅了计划

@if(Auth::user()->subscribed('dailyTest'))
Run Code Online (Sandbox Code Playgroud)

但是有类似的东西

@foreach (Stripe::plans() as $plan)
Run Code Online (Sandbox Code Playgroud)

php laravel-cashier laravel-5.4

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

Knex select查询后如何使用数据

我在使用 knex select 从表中检索数据时遇到了一些麻烦。

我想做这样的事情

function getUserData(userId){
    let user = knex.select('xp','money','rolls','twenty').from('users').where('user_id', userId);
   return user;
}


user = getUserData(userId);
user.xp;   // do something with this value
Run Code Online (Sandbox Code Playgroud)

但这会输出以下内容(如果我console.log它),但不是选择查询中请求的信息,除非我不确定如何检索它:

Builder {
  client:
   Client_MySQL {
 config: { client: 'mysql', connection: [Object] },
 connectionSettings:
  { host: '127.0.0.1',
    user: 'XXXXXXXXXX',
    password: 'XXXXXXXXXX',
    database: 'XXXXXXXXXX' },
 driver:
  { createConnection: [Function: createConnection],
    createPool: [Function: createPool],
    createPoolCluster: [Function: createPoolCluster],
    createQuery: [Function: createQuery],
    escape: [Function: escape],
    escapeId: [Function: escapeId],
    format: [Function: format],
    raw: [Function: raw] },
 pool:
  Pool {
    creator: …
Run Code Online (Sandbox Code Playgroud)

node.js knex.js

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

Laravel 5.4类App \ Http \ Controllers \ Auth \ Request不存在

我需要为电子邮件验证创建自定义登录身份验证,我将发布一些代码片段以使您对问题有所了解:

但是,我收到以下类App \ Http \ Controllers \ Auth \ Request不存在

堆栈溢出表示我需要更多文本,因为它主要是代码,我希望这里的摘录足以使它崩溃。

login.blade-身份验证随附的默认值,只是对美梦音进行了调整

<form class="form-horizontal" method="POST" action="{{ route('loginc') }}">
                    {{ csrf_field() }}

                    <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                        <label for="email" class="col-md-4 control-label">E-Mail Address</label>

                        <div class="col-md-6">
                            <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>

                            @if ($errors->has('email'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('email') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>

                    <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                        <label for="password" class="col-md-4 control-label">Password</label>

                        <div class="col-md-6">
                            <input id="password" type="password" class="form-control" name="password" required> …
Run Code Online (Sandbox Code Playgroud)

php laravel-5.4

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

Laravel Blade - 通过 id 检索元素

我想通过 id 检索一个元素。

在我的刀片文件中:

{{ $auctionStatuses }}
Run Code Online (Sandbox Code Playgroud)

这输出:

[
    {
        "id":1,
        "name":"Awaiting customer action",
        "created_at":"2018-10-04 10:14:08",
        "updated_at":"2018-10-04 10:14:08"
    },
    {
        "id":2,
        "name":"Transfer in progress",
        "created_at":"2018-10-04 10:15:11",
        "updated_at":"2018-10-04 10:15:11"
    },
    {
        "id":3,
        "name":"Completed",
        "created_at":"2018-10-04 10:15:14",
        "updated_at":"2018-10-04 10:15:14"
    }
] 
Run Code Online (Sandbox Code Playgroud)

我想在通过 id 字段引用时输出名称

由于一些数据来自 mongodb,我无法使用标准关系

我已经尝试过这个{{ $auctionStatuses['3'] }} ,但显然那不存在。

我想理想情况下,我想做这样的事情

{{ $auctionStatuses[*]->id['3']->name }}

有没有办法做我需要的事情,而不循环遍历 json 数组?

php json laravel-blade laravel-5.6

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

按顺序生成带有预定义字符的5位字母数字代码

我想生成一个由字母数字字符组成的会员号码,删除i ol在输入时节省混淆.要在php中完成(如果重要的话也使用Laravel 5.7 - 但我觉得这是一个php问题)

如果只使用0-9,会员编号将从00001开始,第一个人和第11个人将有00011.我想使用0-9 + az的字母数字字符(删除所说的字母)

0-9(总共10个字符),abcdefghjkmnpqrstuvwxyz(共23个字符) - 这在每个计数周期(0-10 + aZ)中总共给出33个字符.而不只是10(0-10)

所以第一个会员号仍然是00001,其中第12个现在是0000a,第14个0000c和第34个将是0001a.

总而言之,我需要一种定义字符的方法,以便可以基于用户的id生成的方式进行计数.

我希望我已经解释得这么好了.

php alphanumeric base-conversion id

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

Discord.js 创建私人语音频道和角色

我正在尝试使用 Discord.js 制作一个不和谐机器人,它可以创建一个私人频道和一个新角色,并将该角色分配给该频道。因此,任何具有新角色的用户都可以访问该频道。

以下代码根据我通过“eventName”给它的名称创建了一个频道,它还创建了一个同名的角色。

但是如何将语音通道设为私有,设置一个角色以独占访问它并为新角色设置一些权限?

function addChannel(message,args,eventName){
var server = message.guild;
var permsName = eventName+"-"+message.author.username;
message.guild.createRole({
    //data: {
        name: permsName,
        permissions: []
    //},
    //reason: 'new Event'
}).then(role => {
    message.member.addRole(role,permsName)
    .catch(error => client.catch(error))
}).catch(error => client.catch(error))
server.createChannel(eventName, 'voice').then( // Create the actual voice channel.
    (chan) => {
        chan.setParent("427382662240534535").then( // Move the voice channel to the current message's parent category.
            (chan2) => {
                console.log("stage 3");
                console.log(chan2);
                //console.log(`Set the category of ${chan2.name} to ${chan2.parent.name}`);
                chan2.overwritePermissions(message.guild.roles.find('name', '@everyone'), { 'CREATE_INSTANT_INVITE' : false }); // …
Run Code Online (Sandbox Code Playgroud)

discord.js

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