PhyrePanel/web/app/Livewire/Installer.php
Bozhidar Slaveykov 67cd7ec58b update
2024-04-06 16:01:46 +03:00

45 lines
944 B
PHP

<?php
namespace App\Livewire;
use App\Models\User;
use Livewire\Component;
class Installer extends Component
{
public $step = 1;
public $name;
public $email;
public $password;
public $password_confirmation;
public function install()
{
$this->validate([
'name' => 'required',
'email' => 'required|email|unique:users,email',
'password' => 'required|min:8|confirmed',
'password_confirmation' => 'required|min:8',
]);
$createUser = new User();
$createUser->name = $this->name;
$createUser->email = $this->email;
$createUser->password = bcrypt($this->password);
$createUser->save();
file_put_contents(storage_path('installed'), 'installed-'.date('Y-m-d H:i:s'));
return redirect('/admin/login');
}
public function render()
{
return view('livewire.installer');
}
}