我正在使用 Laravel 5.7,我需要使用 2 个输入(前缀+数字)来验证电话长度。总位数必须始终为 10。
我正在将此自定义规则用于其他工作正常的项目:
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class PhoneLength implements Rule
{
public $prefix;
/**
* Create a new rule instance.
*
* @return void
*/
public function __construct($prefix = null)
{
//
$this->prefix = $prefix;
}
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
//
return strlen($this->prefix)+strlen($value) == 10 ? true : false;
}
/**
* …Run Code Online (Sandbox Code Playgroud) 我知道 Chrome 开发工具中有很多关于这些警告的帖子。对于所有这些,解决方案是关闭通知“启用 javascript 源映射”和“启用 CSS 源映射”。
我想知道的是如何解决这个问题以及导致这些警告的幕后原因是什么。
我目前正在开发一个使用Twilio Js SDK 的Vue JS 应用程序
,当使用以下命令在阶段模式下构建该应用程序时,我收到了大量警告sudo npm run build -- --mode staging
任何建议将被认真考虑。
ls failed to load source map: Could not load content for webpack:///node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack:///node_modules/pusher-js/dist/web/utf8.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack:///node_modules/twilio-video/es5/index.js.map: HTTP error: status code 404, …Run Code Online (Sandbox Code Playgroud) 我想展示 Laravel 提供的私人图像。由于 Laravel 作为 API 工作,任何请求都必须使用包含 Bearer 令牌的 Authorization 标头来完成。
我正在与 Quasar 合作,但我想这根本不重要(除非 Quasar 有正确的方法来做到这一点)
我知道我可以在 URL 中附加令牌,但它看起来不太好,所以我想使用服务工作人员来拦截请求。
在我的 Vue 组件中我有这个
<template>
<img :src="file" />
</template>
<script>
export default {
name: 'MyComponent',
setup(props, context) {
const file = 'http://localhost:8888/files/stream/watermark.png'
onMounted(async () => {
await navigator.serviceWorker
.register('/service-worker.js', { scope: 'http://localhost:9999/files/stream/' })
.then(registration => {
console.log('ServiceWorker registration successful with scope: ', registration.scope)
})
.catch(err => {
console.log('ServiceWorker registration failed: ', err);
})
})
return {
file
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
我的 service-worker.js …
我按照以下步骤在临时环境中安装了 MailHog:
sudo apt-get -y install golang-gogo get github.com/mailhog/MailHog为了手动启动该服务,我这样做:
cd ~/go/bin./MailHog自从我使用 Laravel 以来,我已经开始supervisor竞选工人了。我想知道是否有办法添加新.conf文件来启动 MailHog。
我试图了解 Laravel 工作人员是如何启动的,但到目前为止还没有运气
[program:mailhog]
process_name=%(program_name)s_%(process_num)02d
command=~/go/bin/MailHog
user=ubuntu
stdout_logfile=/var/www/api/storage/logs/mailhog.log
Run Code Online (Sandbox Code Playgroud)
mailhog:mailhog_00: ERROR (no such file)当我尝试启动主管时我得到了。
我需要一种自动启动 MailHog 的方法,无论我需要主管还是通过服务。
如果您能提供从主管或使用服务启动 MailHog 的“秘诀”,我将非常感激。
laravel ×3
vue.js ×2
arrays ×1
mailhog ×1
rules ×1
supervisord ×1
twilio ×1
ubuntu-20.04 ×1
validation ×1
vuejs3 ×1