With knowing that eloquent converts to regular sql at run time anyway, why not just use normal queries. Just my 2 cents.
How to update oracle table using laravel eloquent query
Hi guys,
I have created a table called PROG_TITLE with 3 data fields (PR_ID, PR_TITLE and PR_INDEX). I have populated it with values and I want to update PR_INDEX values with 1 if PR_TITLE is not null.
How can I do it with eloquent query?
The query in oracle is
UPDATE PROG_TITLE SET PR_INDEX = '1' WHERE PR_TITLE IS NOT NULL;
My solution that worked is this. In fact I populated table with all PR_INDEX values set to 1 by default and zeroed them conditionally. The function editor is inside controller obviously.
@jlrdw Thanks a lot for your resources!
public function editor (Request $ppp) { $pppvar = $ppp -> get('identity');
DB::table('prog_title')
->where('pr_id', $pppvar)
->update(array('pr_index' => 0));
return view ('return');
}
Please or to participate in this conversation.