Laravel DB插入错误500

Unable to insert into database in a Laravel controller. Below is the controller. I keep getting an error highlight in Dreamweaver at the following line:

$users = DB::table('records')->insert([
    'product' => 'john@example.com',
    'name' => 'john@example.com',
    'email' => 'john@example.com'
]);

I keep getting error 500

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\DB;

class create extends Controller
{
    //
    public function createRecord(Request $request){
        json_decode($request->getContent(), true);

        //return $request;
        //$something ='asdf';
        //return $something;

        $users = DB::table('records')->insert([
            'product' => 'john@example.com',
            'name' => 'john@example.com',
            'email' => 'john@example.com'
        ]);
    }
}
查看全部
weixin_33738982
?Briella
2016/11/06 22:25
  • laravel
  • post
  • insert
  • php
  • ajax
  • 点赞
  • 收藏
  • 回答
    私信

2个回复