javascript - Input Sanitising Laravel 4 -



javascript - Input Sanitising Laravel 4 -

i using laravel 4 create restful interface angularjs app.

at moment, want update object. model called discount link way is:

$data = input::all(); $affectedrows = discountlink::where('id', '=', $id)->update($data);

(please imagine there kind of validation checks)

i error in laravel.log:

general error: 1 no such column: $edit

edit value passed server because added in angular. don't see need explicitly remove in js question is:

how can create kind of whitelist of key-names model pay attending to. way, if get's passed in accident, rest phone call doesn't have fail.

i guess there arguments sanitising in js pollute code many de-assignment statements become messy, when dealing angularjs:

delete discountlink.$edit;

any suggestions?

$data = input::all(); $discountlink = discountlink::find($id); $discountlink->fill($data); $discountlink->save();

this method working. fillable/guarded attribute must set correct.

update:

new method:

$data = input::all(); $data['id'] = $id; $genre = new genre; $genre->exists = true; $genre->update($data);

it's 1 query, know.

javascript php angularjs rest laravel

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -