public function postUpdateAvatar() { try { $user = \User::getUser(); if (!$user->hasAccess('agency')) { throw new \Exception("Only agency can update their account information", 1); return; } $image = \Agency::updateAvatar($_FILES['file']); return \Response::json(['type' => 'success', 'message' => 'Avatar has been updated.', 'image' => asset($image->image)]); } catch (\Exception $e) { return \Response::json(['type' => 'danger', 'message' => $e->getMessage()]); } }