@@ -21,10 +21,7 @@
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Exceptions\ProfileAlreadyExistsException;
|
||||
use App\Exceptions\ProfileCreationFailedException;
|
||||
use App\Profile;
|
||||
use App\Services\ProfileService;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -43,24 +40,15 @@ class UserObserver
|
||||
*/
|
||||
public function created(User $user)
|
||||
{
|
||||
$profileService = new ProfileService();
|
||||
// TODO: Make sure that the profile is created, throw an exception if otherwise, or try to recreate the profile.
|
||||
Profile::create([
|
||||
|
||||
try
|
||||
{
|
||||
$profileService->createProfile($user);
|
||||
}
|
||||
catch (ProfileAlreadyExistsException $exception)
|
||||
{
|
||||
Log::error('Attempting to create profile that already exists!', [
|
||||
'trace' => $exception->getTrace()
|
||||
]);
|
||||
}
|
||||
catch (ProfileCreationFailedException $e)
|
||||
{
|
||||
Log::error('Failed creating a new profile!', [
|
||||
'trace' => $e->getTrace()
|
||||
]);
|
||||
}
|
||||
'profileShortBio' => 'Write a one-liner about you here!',
|
||||
'profileAboutMe' => 'Tell us a bit about you.',
|
||||
'socialLinks' => '{}',
|
||||
'userID' => $user->id,
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user