小编Yos*_*sef的帖子

Laravel - SQLSTATE [42000]:语法错误或访问冲突:迁移时为1064

我从来没有遇到这个错误,直到现在它发生在我运行php artisan migrate
我正在使用MySQL 5.6.34
我尝试了我能想到的一切):并且仍然没有运气我有一个类似的表这个并且工作正常但是对于一些原因,这曾经不起作用

[PDOException]
  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax
  to use near 'unsigned not null, `address_1` varchar(191) unsigned not null, `address_2` varch' at line 1
Run Code Online (Sandbox Code Playgroud)

这是我的迁移文件

public function up()
    {
        Schema::create('rmaRequests', function (Blueprint $table) {
           $table->increments('id');
           $table->integer('user_id')->unsigned();
           $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
           $table->string('reference_number')->unique();
           $table->string('first_name');
           $table->string('last_name');
           $table->string('email');
           $table->string('phone');
           $table->string('fax');
           $table->string('company');
           $table->integer('marketplaceId')->unsigned();
           $table->string('order_number')->unsigned();
           $table->string('address_1');
           $table->string('address_2');
           $table->string('city');
           $table->string('state');
           $table->string('zip');
           $table->integer('returnTypeId')->unsigned(); …
Run Code Online (Sandbox Code Playgroud)

php mysql laravel laravel-5 laravel-5.3

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

Laravel - 尝试获取非对象的属性:: first()

好的,所以Trying to get property of non-object当我尝试从数据库中获取数据时,我得到了$settings = AdminSettings::first();

这是控制器代码

    <?php

namespace App\Http\Controllers\AdminSettings;

use App\AdminSettings\AdminSettings;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class AdminSettingsController extends Controller
{
    public function index()
    {
        $settings = AdminSettings::first();

        return view('admins.settings.settings', compact('settings'));
    }
}
Run Code Online (Sandbox Code Playgroud)

这是模态代码

    <?php

namespace App\AdminSettings;

use Illuminate\Database\Eloquent\Model;

class AdminSettings extends Model
{
    protected $table = 'site_settings';
    protected $fillable = [
        'site_title', 'site_url', 'email_from', 'email_to', 'timezone', 'date_format', 'time_format',
    ];
}
Run Code Online (Sandbox Code Playgroud)

在这里,我试图把它 site_title into the input but I get Trying to get property of non-object …

php laravel laravel-5 laravel-query-builder

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

Vue js 中使用 Sweetalert2 删除确认

我试图制作一个 sweetalert,当用户单击删除按钮时,它将触发一个 sweetalert,当用户单击时,Yes, Delete it!它应该发出 axois 请求来删除状态。当用户单击Yes, Delete it!sweetalert 时,它会关闭,但从未发出请求。如果我删除 sweetalert 并仅留下请求,它将删除该记录。

删除按钮

<button @click="destroy(statuses.id)" class="btn btn-danger btn-flat btn-sm"> <i class="fa fa-remove"></i> </button>
Run Code Online (Sandbox Code Playgroud)

删除方法

methods: {
            destroy(id) {
                swal({
                    title: "Delete this order status?",
                    text: "Are you sure? You won't be able to revert this!",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#3085d6",
                    confirmButtonText: "Yes, Delete it!",
                }, () => {
                    del('status-delete/' + id)
                })
            }
        }
Run Code Online (Sandbox Code Playgroud)

javascript laravel vue.js sweetalert2

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