Angularjs / Laravel POST返回500内部服务器错误

时间:2015-08-15 22:24:34

标签: angularjs http laravel eloquent

我知道这已被问了很多,但我似乎无法找到错误。 要开始,有什么可能我可以laravel让显示比500内部服务器更多的specefic错误?因为我只是假设我现在传递了错误的数据,但我无法确定......

我发布的数据:

Vertrekpuntvallt=50.93766174471314&Vertrekpuntvallng=3.8891601562499996&Eindpuntvallt=51.07246834624617
&Eindpuntvallng=3.592529296875&name=blablabla&description=beschrijvint+blabla&ridedate=Sat+Oct+10+2015
+00%3A00%3A00+GMT%2B0200+(CEST)&ridetime=Thu+Jan+01+1970+11%3A11%3A11+GMT%2B0100+(CET)&ridepersons=3
&ridevertrekpunt=Svhool&rideeindpunt=Dinge

我的提交功能(不返回specefic错误):

        $scope.submitRide = function() {
            Ride.save($scope.rideData)
                .success(function (data) {
                    console.log("Da hebe hij goed gedaan jong!");
                })
                .error(function(error) {
                    console.log("nope");
                    console.log(error);
                });
    };

我的控制器:

    public function store(StoreRideRequest $request)
{
    $todo = Ride::create($request->all());
    return $todo;
}

我的SoreRideRequest规则:

    public function rules()
{
    return [
        'name' => 'required',
        'description' => 'required',
        'ridedate' => 'date',
//Update: 'ridetime' => 'time' is not possible!! Still not fixed though :D
        //'ridetime' => 'time',
        'ridepersons' => 'required',
        'ridevertrekpunt' => 'required',
        'rideeindpunt' => 'required',
        'Vertrekpuntvallt' => 'required',
        'Vertrekpuntvallng' => 'required',
        'Eindpuntvallt' => 'required',
        'Eindpuntvallng' => 'required'
    ];
}

最后我的模特:

   protected $fillable = [
    'name',
    'description',
    'ridedate',
    'ridetime',
    'ridepersons',
    'ridevertrekpunt',
    'rideeindpunt',
    'Vertrekpuntvallt',
    'Vertrekpuntvallng',
    'Eindpuntvallt',
    'Eindpuntvallng'
];

protected $hidden = [
    'created_at',
    'updated_at',
    'deleted_at',
];

protected $dates = [
    'ridedate'
];

public function user()
{
    return $this->belongsTo(User::class);
}

更新:我还会发布我的数据库的一部分:

            // Data
        $table->string('name');
        $table->text('description');
        $table->date('ridedate');
        $table->time('ridetime');
        $table->tinyInteger('ridepersons');
        $table->string('ridevertrekpunt');
        $table->string('rideeindpunt');
        $table->float('Vertrekpuntvallt');
        $table->float('Vertrekpuntvallng');
        $table->float('Eindpuntvallt');
        $table->float('Eindpuntvallng');


        // Foreign Keys
        $table->integer(CreateRidesTable::FK)
            ->unsigned();
        $table->foreign(CreateRidesTable::FK)
            ->references(CreateRidesTable::PK)
            ->on(CreateUsersTable::TABLE)
            ->onDelete('cascade');

我知道这里有一些错误的数据?但我似乎无法弄明白。

0 个答案:

没有答案