Since you are referencing 'created_at', that's a value that gets parsed first. You can 'return' your own format.
For example purposes, try adding this to the model:
public function getMyCorrectFormatDate()
{
return $this->created_at->format('d.m.Y');
}
then, you can call it using something like:
//controller
$model = Model::findOrFail(1); //Model being the model that contains getMyCorrectFormatDate() method
//template in blade
{{ $model->created_at; }}
Off the top of the head, so let me know if it even works.
Thanks for the help but I am using DB::RAW not eloquent. Also I am not using any blade templating. I am using
I Figured it out, I just used
DB::raw('DATE_FORMAT(ideas.created_at,"%Y-%c-%d") as cdate')
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community