I have a pins table in my database with a pin_date column.
In my migration I have this:
$table->dateTime('pin_date')->nullable();
I have a button that points to a post route
Route::post('/pins/pin-date/{id}', 'PinsController@pinDate');
that leads to a pinDate controller method:
public function pinDate($id)
{
$pin = Pin::find($id);
$pin->save();
}
I want to update the pin-date column in the database to the current date and time when I click the button and hit the route. I am not really sure how to do this. Any help would be greatly appreciated! Thank you!