2017-05-25 02:10
浏览 107

如何在LARAVEL 5.2中将数据存储到数据库

Iam beginer on Laravel, i have problem when i want to store data to database. When name on view different with field name on database data didn't save on database but when input name on view same with field name on database data stored correctly

example this is view

<div class="form-group">
    <div class="row">
        <div class="col-md-3">
            <input type="text" class="form-control" name="job" placeholder="Job">
<div class="form-group">
    <div class="row">
        <div class="col-md-3">
            {{ Form::select('machine', $mesin_laminating->pluck('active', 'kode')->all(), null, ['class' => 'form-control select2'])}}                                      


this is my controller

 public function store(Request $request)
    $this->validate($request, [
        'job' => 'required',
        'machine' => 'required'

    $input = $request->all();


this is my model

protected $table = 'tb_job';

protected $fillable = ['user_job', 'machine'];

this is my database

user_job | machine
------   | ------
Cell     | Cell

How to scyn job on controller to store on user_job? Sorry for my english

2条回答 默认 最新

相关推荐 更多相似问题