Skip to content

Commit

Permalink
Get rid of SpaceRepository
Browse files Browse the repository at this point in the history
  • Loading branch information
range-of-motion committed Dec 29, 2023
1 parent b855cc0 commit 1140d24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
18 changes: 8 additions & 10 deletions app/Http/Controllers/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,15 @@
use App\Actions\SendVerificationMailAction;
use App\Models\Currency;
use App\Models\LoginAttempt;
use App\Models\Space;
use App\Models\User;
use Illuminate\Http\Request;
// use App\Http\Controllers\Controller;

use App\Repositories\SpaceRepository;
use Illuminate\Support\Facades\Auth;

class RegisterController extends Controller
{
private $spaceRepository;

public function __construct(
SpaceRepository $spaceRepository,
) {
$this->spaceRepository = $spaceRepository;
}

public function index()
{
if (config('app.disable_registration')) {
Expand All @@ -44,7 +36,13 @@ public function store(Request $request)
$request->validate(User::getValidationRulesForRegistration());

$user = (new CreateUserAction())->execute($request->name, $request->email, $request->password);
$space = $this->spaceRepository->create($request->currency, $user->name . '\'s Space');

$space = Space::query()
->create([
'currency_id' => $request->currency,
'name' => $user->name . '\'s Space',
]);

$user->spaces()->attach($space->id, ['role' => 'admin']);

(new SendVerificationMailAction())->execute($user->id);
Expand Down
16 changes: 0 additions & 16 deletions app/Repositories/SpaceRepository.php

This file was deleted.

0 comments on commit 1140d24

Please sign in to comment.