小编Shi*_*ker的帖子

使用grep在两个特定单词/字符之间获取字符串的模式

我需要从像这样的字符串中提取电子邮件地址(我正在创建一个日志解析器): <some text> from=someuser@somedomain.com, <some text>

egrep(或grep -Eo).所以字符串只需要在"from="和之间拉出",",因为日志的其他部分也包含电子邮件地址,比如to=etc

regex bash grep

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

Laravel 5.5 队列:[] 没有连接器

我有两个网站运行相同的 laravel 5.5 项目。事实上,这两个网站都托管在同一台服务器上。其中一个有效,另一个有队列问题。我已经仔细检查了一切。 .env

...
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=database
QUEUE_DRIVER=database
...
Run Code Online (Sandbox Code Playgroud)

conf/queue.php

'database' => [
            'driver' => 'database',
            'table' => 'jobs',
            'queue' => 'default',
            'retry_after' => 90,
        ],
Run Code Online (Sandbox Code Playgroud)

我也有空jobs桌子。每当我尝试运行队列时,我都会收到错误消息

php artisan queue:work --daemon

In QueueManager.php line 172:

  No connector for []  
Run Code Online (Sandbox Code Playgroud)

php laravel-5

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

NuxtJS i18n [vue-router] 名称为 about_us___en 的路由不存在

我使用 nuxtjs 2.10.x 和 i18n 模块。Nu 自定义中间件或类似的东西。路由工作正常。

我的nuxt.config.js模块/i18n 部分:

    ...
modules: [
'@nuxtjs/axios',
'@nuxtjs/pwa',
'@nuxtjs/auth',
'@nuxtjs/dotenv',
'nuxt-fontawesome',
[
  'nuxt-i18n',
  {
    locales: [
      {
        code: 'en',
        iso: 'en-US',
        file: 'en.json',
        name: 'English'
      },
      {
        code: 'zh',
        iso: 'zh-CN',
        file: 'zh.json',
        name: '????'
      }
    ],
    lazy: true,
    langDir: 'locales/',
    defaultLocale: 'en',
    strategy: 'prefix_except_default',
    differentDomains: false,
    vueI18n: {
      fallbackLocale: 'en'
    },
    detectBrowserLanguage: {
      useCookie: true,
      cookieKey: 'lang'
    }
  }
    ]
  ],
...
Run Code Online (Sandbox Code Playgroud)

页面文件夹结构:

  'pages/'
    |--'contact_us.vue'
    |--'_lang/'
         |--'contact_us.vue'
Run Code Online (Sandbox Code Playgroud)

但我收到了这个疯狂的警告:[vue-router] Route with …

vue.js nuxt.js nuxt-i18n

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

veeValidate 3.x + Nuxt js:将自定义错误推送到 ValidationObserver

我使用 Nuxt js + veeValidate 3.x

我的插件看起来像这样:

import Vue from 'vue'
import {
  ValidationObserver,
  ValidationProvider,
  extend
} from 'vee-validate'
import { required, email, min, confirmed } from 'vee-validate/dist/rules'

extend('required', {
  ...required,
  message: 'This field is required'
})
extend('email', email)
extend('min', min)
extend('confirmed', confirmed)
Vue.component('ValidationProvider', ValidationProvider)
Vue.component('ValidationObserver', ValidationObserver) 
Run Code Online (Sandbox Code Playgroud)

作为插件添加到nuxt.config.js plugins: [{ src: '~/plugins/vee-validate.js', ssr: false }, .. 模板中,如下所示:

<ValidationObserver ref="registrationForm"> 
   <ValidationProvider rules="required|email" name="Email Address" v-slot="{ errors }">
    <div>
     <input type="text" v-model.lazy="user.email"/>
     <span class=form-errors">{{ errors[0] }}</span>
    </div>
   </ValidationProvider>
</ValidationObserver>
Run Code Online (Sandbox Code Playgroud)

验证以这种方式完美运行:

methods: …
Run Code Online (Sandbox Code Playgroud)

nuxt.js vee-validate

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

ALTER表列到timestamp now()属性

我在互联网上找到的样本中创建了一张表格.该列的定义stored是:

stored  | timestamp without time zone | default '2014-04-11 21:19:20.144487'::timestamp without time zone
Run Code Online (Sandbox Code Playgroud)

如何将此更改为"正常"时间戳now()类型?那么它会在插入数据时标记当前的日期时间?

谢谢大家!

postgresql timestamp

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

Laravel:雄辩的orderBy hasOne关系列与with

我有一个OrdershasOne关系的模型participant

public function participant()
{
    return $this->hasOne('App\OrderParticipant', 'order_id');
}
Run Code Online (Sandbox Code Playgroud)

我需要检索Orders排序依据participant.last_name

我的方法

$orders = \App\Orders::with(['participant',])
              ->where('user_id', $user->id)  
              ->orderBy('participant.last_name')
              ->get();
Run Code Online (Sandbox Code Playgroud)

失败:

未定义的表:7错误:缺少表\“参与者\” \ nLINE的FROM子句条目:... 1

收集后我已经尝试对它进行排序

return $orders->sortBy('participant.last_name');
Run Code Online (Sandbox Code Playgroud)

但这根本没有排序

顺便说一句我正在使用postgres

谢谢。

php laravel laravel-5 laravel-5.7

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