Laravel模型不节约

时间:2017-01-06 07:03:15

标签: mysql laravel-5 eloquent

模型正在保存,但除了日期之外,所有都是空值 没有抛出错误。 我的迁移会直接从字段中复制 $ fillable 。 我无法找到为什么它在数据库上保存空值 这是我的代码

我的模特

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Disbursement_Information extends Model
{
    use SoftDeletes;
    protected $table = 'disbursement';
    protected $fillable = [ 
        'cv_number',
        'payee_id',
        'amount',
        'check_number',
        'release_date',
        'first_collection_date',
        'last_collection_date',
        'maturity_date'
    ];
    protected $dates = [
        'created_at',
        'updated_at',   
        'deleted_at'
    ];





}

我的控制器

 public function postDisbursement(Request $request, $id){
    $loans = new Disbursement_Information;
    $input = $request->all();
    $loans->save($input);

}

HTML表格

<div id="step-1">

        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header"> List of All Clients</h1>
                <h2>Total Clients: <b>3</b></h2>
                <div class="row">

                </div>
            </div>
            </div>

            <!-- /.col-lg-12 -->
        </div>
        <hr>
        <div class="col-lg-6 col-md-6">
            <div class="form-group">
                <label for="cv_number"> Check Voucher # </label>
                <input type="text" class="form-control" name="cv_number" id="cv_number" required>
            </div>
        </div>
        <div class="col-lg-6 col-md-6">
            <div class="form-group">
                <label for="check_number"> Check # </label>
                <input type="text" class="form-control" name="check_number" id="check_number" required>
            </div>
        </div>
        <div class="col-lg-6 col-md-6">
            <div class="form-group">
                <label for="first_collection_date"> First Payment  </label>
                <input type="date" class="form-control" name="first_collection_date" id="first_collection_date" required>
            </div>
        </div>
        <div class="col-lg-6 col-md-6">
            <div class="form-group">
                <label for="last_collection_date"> Last Payment </label>
                <input type="date" class="form-control" name="last_collection_date" id="last_collection_date" required>
            </div>
        </div>
        <div class="col-lg-6 col-md-6">
            <div class="form-group">
                <label for="maturity_date"> Maturity Date </label>
                <input type="date" class="form-control" name="maturity_date" id="maturity_date" required>
            </div>
        </div>
        <div class="col-lg-6 col-md-6">
            <div class="form-group">
                <label for="payee_name"> Payee  </label>
                <input type="text" class="form-control" name="payee_name" id="payee_name" readonly>
                <input type="hidden" class="form-control" name="payee_id" id="payee_id" required> 
            </div>
        </div>

                <input type="hidden" name="_token" value="JvvXJbloRAzQnj4oz4ve6Z8OLLia270Fs6utSO5a">
                <table class="table table-striped">
                    <thead>
                        <th>Name</th>
                        <th style="">Loan Amount</th>
                        <th style="text-align:center">Action</th>
                    </thead>
                    <tbody>
                                                    <tr >
                                <td class="">
                                    Morgado, Ashbee, Allego
                                </td>
                                <td>
                                    <input type="number" min="2000" max="99000" name="loan_amount[1]" class="form-control loan-amount"> 
                                </td>
                                <td style="text-align:center">
                                    <div class="radio">
                                        <label><input type="checkbox" class="reloan" name="reloan[1]" p_id = "1 "p_name="Morgado, Ashbee, Allego" target-rdb="rdb1"> Not re-loaning/loaning </label>
                                        <label  id="rdb1"><input type="radio" class="rdbPayee" name="payee_id" value="1" p_name="Morgado, Ashbee, Allego">Mark As Payee</label>
                                    <button type="button" class="btn btn-sm btn-default loan-summary"><i class="fa fa-info-circle fa-5" aria-hidden="true"></i></button>
                                    </div>

                                </td>
                            </tr>
                                                    <tr >
                                <td class="">
                                    Melton, Barbara, None
                                </td>
                                <td>
                                    <input type="number" min="2000" max="99000" name="loan_amount[2]" class="form-control loan-amount"> 
                                </td>
                                <td style="text-align:center">
                                    <div class="radio">
                                        <label><input type="checkbox" class="reloan" name="reloan[2]" p_id = "2 "p_name="Melton, Barbara, None" target-rdb="rdb2"> Not re-loaning/loaning </label>
                                        <label  id="rdb2"><input type="radio" class="rdbPayee" name="payee_id" value="2" p_name="Melton, Barbara, None">Mark As Payee</label>
                                    <button type="button" class="btn btn-sm btn-default loan-summary"><i class="fa fa-info-circle fa-5" aria-hidden="true"></i></button>
                                    </div>

                                </td>
                            </tr>
                                                    <tr >
                                <td class="">
                                    Bonyton, Ester, Jaxis
                                </td>
                                <td>
                                    <input type="number" min="2000" max="99000" name="loan_amount[3]" class="form-control loan-amount"> 
                                </td>
                                <td style="text-align:center">
                                    <div class="radio">
                                        <label><input type="checkbox" class="reloan" name="reloan[3]" p_id = "3 "p_name="Bonyton, Ester, Jaxis" target-rdb="rdb3"> Not re-loaning/loaning </label>
                                        <label  id="rdb3"><input type="radio" class="rdbPayee" name="payee_id" value="3" p_name="Bonyton, Ester, Jaxis">Mark As Payee</label>
                                    <button type="button" class="btn btn-sm btn-default loan-summary"><i class="fa fa-info-circle fa-5" aria-hidden="true"></i></button>
                                    </div>

                                </td>
                            </tr>
                                            </tbody>
                </table>
                <div class="modal-footer">

                <button type="submit" class="btn btn-success"> Submit </button>
                </div>


    </div>

0 个答案:

没有答案