mercredi 24 mai 2017

How to store data to database in 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">
            <label>Job</label>
            <input type="text" class="form-control" name="job" placeholder="Job">
        </div>
    </div>
</div>
<div class="form-group">
    <div class="row">
        <div class="col-md-3">
            <label>Machine</label>
                                                  
        </div>
    </div>

</div> 

this is my controller

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

    $input = $request->all();
    SpkAdmin::create($input);

}

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



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

Aucun commentaire:

Enregistrer un commentaire