You need to use Laravel awesome Eloquent to automatically create timestamps written to the database ...
As you can see, your example code for the eloquent will look like this:
$lot_inputs = array( 'lot' => $request->cycle_lot, 'is_active' => 1 ); $new_lot = Lot::create($lot_inputs);
Note that you have a model for the table = 'lots' (and it should extend Eloquest) so you can easily use the Eloquent methods and its properties ...
It would be great if you make the most of Eloquent ORM so that in the future you want to change your database technology, then you won, you do not need to specify written eloquent queries again (for example: converting a query into different database languages ββis automatically performed by Eloquent)
Thank you, I hope this helps you solve your problem .. !!
source share