When I Retrieve date from SQL database in my laptop only it back to me like (May 17 2016 12:00:00:AM) but any server or another laptop back like (2016-05-17), it appears when I call date column from database and I think this issue not from code I think in PHP or apache2 in my laptop.
This is my code:
$user_data = User::with('employee')
->where('id', Auth::user()->id)
->get()
->first()
->toArray();
dd($user_data['employee']['hire_date']);
2
Answers
The reason this is occuring is likely to be because on your laptop you have a DATETIME field in the database and on the server you have a DATE field. These field types are fundamentally different.
The best way is to use mutators in laravel, and also using the Carbon package.
It should be implemented like this:
Employee.php