samedi 22 août 2015

How to insert data to DB in laravel?

I have loans tables and this model : class loan extends Model { protected $fillable = ['Rate','InstallmentPeriod','LoanPeriod'];

public function installment()
{
    return $this->hasMany('app\installment');
}

public function source()
{
    return $this->belongsTo('app\source');
}

} now I wanna insert data to my loans table , I try this: public function store(Request $request) { $loan = Loan::create(['Rate'=>$request->input('loanRate'), 'InstallmentPeriod'=>$request->input('installmentPeriod'), 'LoanPeriod'=>$request->input('loanPeriod')]);

}

but it did not work... what shlould I do? :D



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1JrxkHT
via IFTTT

Aucun commentaire:

Enregistrer un commentaire