Calculate Age from date stored in database in Y-m-d using Laravel 5.2
Hi User's add their DOB through the Form that store in database, I would like calculate age from stored date in the database which is in this format Y-m-d, My Question is : How to calculate Age? Where to put the logic , In Controller or Model? How to pass the stored Date in view in this format 'm-d-Y' How to pass the result of logic which is age in view. I am using something as below in my model is this Right? This is controller: public function index() { $profile = User::find($this->userid())->profiledetailsHasOne; //This has Dob field return view('profile.index',['profile' => $profile ]); }