fix a few things
This commit is contained in:
@@ -5,11 +5,9 @@ namespace App\Http\Controllers;
|
||||
use App\Models\InstanceSettings;
|
||||
use App\Models\Project;
|
||||
use App\Models\S3Storage;
|
||||
use App\Models\Server;
|
||||
use App\Models\StandalonePostgresql;
|
||||
use App\Models\TeamInvitation;
|
||||
use App\Models\User;
|
||||
use App\Models\Waitlist;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
@@ -19,12 +17,6 @@ class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, ValidatesRequests;
|
||||
|
||||
public function waitlist() {
|
||||
$waiting_in_line = Waitlist::whereVerified(true)->count();
|
||||
return view('auth.waitlist', [
|
||||
'waiting_in_line' => $waiting_in_line,
|
||||
]);
|
||||
}
|
||||
public function subscription()
|
||||
{
|
||||
if (!isCloud()) {
|
||||
|
||||
@@ -6,7 +6,6 @@ use App\Models\Project;
|
||||
use App\Models\S3Storage;
|
||||
use App\Models\Server;
|
||||
use Livewire\Component;
|
||||
use Log;
|
||||
|
||||
class Dashboard extends Component
|
||||
{
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
namespace App\Http\Livewire\Waitlist;
|
||||
|
||||
use App\Jobs\SendConfirmationForWaitlistJob;
|
||||
use App\Models\User;
|
||||
use App\Models\Waitlist as ModelsWaitlist;
|
||||
use App\Models\Waitlist;
|
||||
use Livewire\Component;
|
||||
|
||||
class Waitlist extends Component
|
||||
class Index extends Component
|
||||
{
|
||||
public string $email;
|
||||
public int $waiting_in_line = 0;
|
||||
public int $waitingInLine = 0;
|
||||
|
||||
protected $rules = [
|
||||
'email' => 'required|email',
|
||||
];
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.waitlist.index')->layout('layouts.simple');
|
||||
}
|
||||
public function mount()
|
||||
{
|
||||
$this->waitingInLine = Waitlist::whereVerified(true)->count();
|
||||
if (isDev()) {
|
||||
$this->email = 'waitlist@example.com';
|
||||
}
|
||||
@@ -29,7 +34,7 @@ class Waitlist extends Component
|
||||
if ($already_registered) {
|
||||
throw new \Exception('You are already on the waitlist or registered. <br>Please check your email to verify your email address or contact support.');
|
||||
}
|
||||
$found = ModelsWaitlist::where('email', $this->email)->first();
|
||||
$found = Waitlist::where('email', $this->email)->first();
|
||||
if ($found) {
|
||||
if (!$found->verified) {
|
||||
$this->emit('error', 'You are already on the waitlist. <br>Please check your email to verify your email address.');
|
||||
@@ -38,7 +43,7 @@ class Waitlist extends Component
|
||||
$this->emit('error', 'You are already on the waitlist. <br>You will be notified when your turn comes. <br>Thank you.');
|
||||
return;
|
||||
}
|
||||
$waitlist = ModelsWaitlist::create([
|
||||
$waitlist = Waitlist::create([
|
||||
'email' => $this->email,
|
||||
'type' => 'registration',
|
||||
]);
|
||||
@@ -43,22 +43,16 @@ class FortifyServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
|
||||
Fortify::createUsersUsing(CreateNewUser::class);
|
||||
Fortify::registerView(function () {
|
||||
$settings = InstanceSettings::get();
|
||||
$waiting_in_line = Waitlist::whereVerified(true)->count();
|
||||
if (!$settings->is_registration_enabled) {
|
||||
return redirect()->route('login');
|
||||
}
|
||||
if (config('coolify.waitlist')) {
|
||||
return view('auth.waitlist',[
|
||||
'waiting_in_line' => $waiting_in_line,
|
||||
]);
|
||||
return redirect()->route('waitlist.index');
|
||||
} else {
|
||||
return view('auth.register',[
|
||||
'waiting_in_line' => $waiting_in_line,
|
||||
]);
|
||||
return view('auth.register');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user