下面的迁移脚本在旧版本的Laravel中运行平稳,但是我将其添加到了新的Laravel 5.8中并运行了该脚本。我越来越Error: foreign key was not formed correctly
评估迁移:
public function up() {
Schema::create('evaluation', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
}
Run Code Online (Sandbox Code Playgroud)
用户迁移:
public function up() {
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->timestamps();
});
}
Run Code Online (Sandbox Code Playgroud) 我有以下数组:
array(10) {
[0]=>
array(2) {
["id"]=>
string(2) "73"
["position"]=>
string(1) "1"
}
[1]=>
array(2) {
["id"]=>
string(2) "58"
["position"]=>
string(1) "2"
}
[2]=>
array(2) {
["id"]=>
string(2) "82"
["position"]=>
string(1) "3"
}
[3]=>
array(2) {
["id"]=>
string(2) "84"
["position"]=>
string(1) "4"
}
[4]=>
array(2) {
["id"]=>
string(2) "74"
["position"]=>
string(1) "5"
}
[5]=>
array(2) {
["id"]=>
string(2) "59"
["position"]=>
string(1) "6"
}
[6]=>
array(2) {
["id"]=>
string(2) "72"
["position"]=>
string(1) "7"
}
[7]=>
array(2) {
["id"]=>
string(2) "78"
["position"]=> …
Run Code Online (Sandbox Code Playgroud) 我知道@RachidLaasri/LaravelInstaller,但它是我想要的一种不同的东西。
我想做一些类似的事情,转到 localhost::8000/installer 这样的 URL。然后,它会显示一个超级管理员注册页面,即电子邮件、密码和用户名。注意:我想消除让我的超级管理员应用程序用户进入 UsersTableSeeder 进行配置的能力。
然后,当我单击安装时,它会迁移我的种子类。我目前正在观看命令行应用程序,但仍然无法真正弄清楚如何解决这个问题。
任何建议/提示将不胜感激。
我已经从旧服务器迁移到新服务器。新服务器有相当大的变化。旧服务器使用 PHP5.6
和 phalcon 3.2
,新服务器使用 PHP7.3
和 phalcon 3.4.4
。
在旧服务器电子邮件发送工作顺利,但在新服务器中,它抛出以下错误:
Swift_TransportException:无法使用 TLS 加密连接
两个站点中的服务器邮件配置为:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls
Run Code Online (Sandbox Code Playgroud)
注意:旧站点已开启http
,新站点已开启https
我想在用户email
单击订阅按钮时将其保存到数据库。但是,当我输入电子邮件并单击“订阅”按钮时,它将传递一个空数组!
订阅表格代码:
<form id="cx-subscribe-user">
<input type="text" name="email" id="email" placeholder="Enter Your Email" />
<button type="submit" id="subscribe-button">Subscribe</button>
</form>
Run Code Online (Sandbox Code Playgroud)
js代码:
$('#cx-subscribe-user').on('click', function (e) {
e.preventDefault();
var email = $('#email').val();
$.ajax({
type: "GET",
url: "subscribe-the-user.php",
processData: false,
dataType: 'json',
data: {email: email},
success: function(data) {
console.log('saved scucess');
}
});
});
Run Code Online (Sandbox Code Playgroud)
在subscribe-the-user.php
文件中,我试图var_dump请求,但它正在打印空数组:
var_dump($_GET);exit;
Run Code Online (Sandbox Code Playgroud)
在var_dump中,我收到这个空数组
array(0) {}