The timestamps are being filled in both the created_at and updated_at when a record is created in my database. Has this happened to anyone before? How can I fix it? My code is below:
Thanks for any help.
$user = User::find(Auth::user()->id);
$username = $user->username;
$page = new Page;
$page->page_title = Input::get('page_title');
$page->slug = Input::get('slug');
$page->page_body = Input::get('page_body');
$page->created_by = $username;
$page->save();
This supposed to happen.
What else did you expect?
If you don't want it to happen, you can disable it per model. Don't know why you'd do that though.
Sorry. I expected that a record was created. And then when the record was edited, updated_at would be changed.
Thought I was doing something wrong.
You could config to do this directly in your schema database and not eloquent.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community