我刚刚升级5.2了laravel的安装,5.3然后继续5.4使用官方升级方法.
我现在正尝试使用其中一项新功能,创建一个降价形式的电子邮件.
根据以下网站提供的文档:https://laravel.com/docs/5.4/mail#view-data
要嵌入内嵌图像,请
$message在电子邮件模板中的变量上使用嵌入方法.Laravel自动使$message变量可用于您的所有电子邮件模板,因此您无需担心手动传递它:
但是,这个:
<img src="{{ $message->embed(public_path().'/img/official_logo.png') }}">
Run Code Online (Sandbox Code Playgroud)
将产生以下错误:
未定义的变量:
message
我错过了什么吗?或者升级指南中是否有未记录的内容?
稍后编辑:
我正在调用电子邮件功能:
\Mail::to($user)->send(new WelcomeCandidate($user, $request->input('password')));
而WelcomeCandidate看起来像:
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Models\User;
class WelcomeCandidate extends Mailable
{
use Queueable, SerializesModels;
public $user;
public $password;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct(User $user, $password)
{
//
$this->user = $user;
$this->password …Run Code Online (Sandbox Code Playgroud) 这个问题与使用intl-tel-input和vuejs2有关/类似,这仍然没有答案.
并且VueJS使用prop作为具有解决方案的数据属性值,但稍微解释了"环境".
所以,长话短说,我动态设置一个新的引导选项卡(标题和URL),然后尝试(重新)绑定一些功能使用jQuery.
在我的Vue方法中添加以下行https://github.com/thecodeassassin/bootstrap-remote-data/blob/master/js/bootstrap-remote-tabs.js#L258将应用该功能,但仅当我触发改变两次.
与第一个(未答复的)问题相同的问题.
可能有人解释一下的事物之间是如何工作vueJS和jQuery?以及如何解决问题,希望无需重写jQuery包.
如果console.log我的变量只是落后一步.
LE:
我为相关提到的问题准备了一支笔:https: //codepen.io/AngelinCalu/pen/LWvwNq
我有这个奇怪的错误,我无法弄清楚.
我正在使用最新的VueJS,从官方CDN中提取:
<script src="https://unpkg.com/vue/dist/vue.js"></script>
指定的行如下所示:
有没有人经历过这个?这是一个VueJS问题吗?
稍后编辑:
我相信错误在这里:
attrs: {
"type": "text",
"name": "phone",
"value": "",
"id": "phone",
"phone_number":
}
Run Code Online (Sandbox Code Playgroud)
由于某种原因,"phone_number"字段上的v-bind无法正常工作.
删除:phone_number="phone_number"并再次写入,它只是工作.
在我的应用程序已经更新从关系one-to-many来many-to-many,我试图找出一种方法来坚持相关的功能.
假设我有两张相关的桌子,例如狗和主人.如果我拥有一系列所有者,并且我正在尝试为这些所有者获取狗ID列表,我该如何雄辩地做到这一点?
类似的问题在这里被问到:https: //laracasts.com/discuss/channels/laravel/getting-many-to-many-related-data-for-an-array-of-elements
那么,我如何获得阵列中的Dog模型Owner呢?
同样的事情,$associatedDogs = Dog::whereIn('owner_id',$ListOfOwners)->get();是一个One-To-Many关系,但对Many-to-Many.
首先,我刚刚开始玩 VueJS,所以这不能是这里建议的 VueJS 版本
它可能是以下内容的副本:
v-bind一次值。我的问题始于我的 Html 看起来像这样:
<div id="app">
<div class="row">
<div class="form-group col-md-8 col-md-offset-2">
<birthday-controls
:birthDay="birthDay"
:birthMonth="birthMonth"
:birthYear="birthYear">
</birthday-controls>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
和JS:
Vue.component('birthday-controls', {
template: `<div class="birthday">
<input type="text" name="year" placeholder="yyyy" v-model="birthYear" size="4" maxlength="4"/>
<input type="text" name="month" placeholder="mm" v-show="validYear" v-model="birthMonth" size="3" maxlength="2"/>
<input type="text" v-show="validYear && validMonth" name="day" placeholder="dd" v-model="birthDay" size="2" maxlength="2"/>
</div>`,
props: ['birthDay', 'birthMonth', 'birthYear'],
computed: { …Run Code Online (Sandbox Code Playgroud) 我想实现https://github.com/jackocnr/intl-tel-input用vuejs2。
如果我在一个 jQuery 里面添加document.ready,$('#phone').intlTelInput({ options...})
一切都按预期工作,但是当我尝试获取输入字段的值和一些boolean有效属性时,我总是检查值落后一步。
我的检查方法如下:
validatePhoneNumber: function() {
var validPhoneNo = $("#phone").intlTelInput("isValidNumber");
var phoneNo = $("#phone").intlTelInput("getNumber");
console.log(phoneNo + ' -> ' + validPhoneNo); //this line returns values one step behind
bus.$emit('validate-phone', validPhoneNo)
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<input class="form-control" @keydown="validatePhoneNumber" :class="{validInput: validPhone }" type="text" name="phone" value="" id="phone" :phone_number="phone_number">
Run Code Online (Sandbox Code Playgroud)
我相信解决方案是为此问题创建一个新指令,我尝试了以下操作:
删除,我实例化的部分intlTelInput上document.ready,并做出这个:
Vue.directive('telinput', {
bind: function(el) {
$(el).intlTelInput({
//options here...
}
});
Run Code Online (Sandbox Code Playgroud)
并添加v-telinput到我HTML上面的代码中。
有了这个,似乎没有任何效果。
我在那里缺少什么?
我真的在努力解决以下问题:
一些索引页面:
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<div id="app">
<ul>
<li>some existing option</li>
<example-component :foo="foo" :bar="bar"/>
</ul>
<a @click.prevent="showDetail(1, 'abc')" href="#" >Click ME!</a>
</div>
<script src="app.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
一些单个文件组件:
<template>
<li><a v-show="checkBool" data-toggle="tab" class="some-class" href="#container-div" data-tab-url="{{ this.foo }}">{{ this.bar }}</a></li>
</template>
<script>
export default {
props: ['foo', 'bar'],
computed: {
checkBool: function() {
return (this.foo != undefined && this.bar != undefined )
}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
而且app.js看起来是这样的:
import Vue from 'vue'
Vue.component('example-component', require('ExampleComponent.vue'));
const app …Run Code Online (Sandbox Code Playgroud) 我的问题似乎与$_POST 类似,为空。Nginx OSx, $_POST 在 nginx 中为空,$_GET 已填充,但 $_REQUEST 为空,但是我找不到适合我的解决方案。
长话短说,我无法将 POST 请求发送到server.php服务器上指定的文件。
假设 myserver.php仅包含以下内容:
<?php var_dump($_REQUEST);
Run Code Online (Sandbox Code Playgroud)
我的sites-available/domain.tld文件包含以下内容:
server {
root /var/www/domain.tld/current/dist;
index index.html index.htm;
server_name domain.tld;
location / {
try_files $uri $uri/ index.php?$query_string =404;
}
location ~ \.php$ {
#limit_except POST {
# allow 127.0.0.1;
# deny all;
#}
#if ( $request_method !~ ^POST$ ) {
# return 405;
#}
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
#fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param …Run Code Online (Sandbox Code Playgroud) vuejs2 ×4
javascript ×3
vue.js ×3
jquery ×2
laravel ×2
ecmascript-6 ×1
email ×1
laravel-5 ×1
laravel-5.4 ×1
many-to-many ×1
nginx ×1
nginx-config ×1
php ×1
ubuntu ×1
ubuntu-18.04 ×1
webpack ×1