-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f80a337
commit 635cc4d
Showing
37 changed files
with
1,435 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
APP_NAME=Laravel | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
|
@@ -37,25 +36,9 @@ MAIL_ENCRYPTION=null | |
MAIL_FROM_ADDRESS="[email protected]" | ||
MAIL_FROM_NAME="${APP_NAME}" | ||
|
||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= | ||
AWS_DEFAULT_REGION=us-east-1 | ||
AWS_BUCKET= | ||
AWS_USE_PATH_STYLE_ENDPOINT=false | ||
|
||
PUSHER_APP_ID= | ||
PUSHER_APP_KEY= | ||
PUSHER_APP_SECRET= | ||
PUSHER_HOST= | ||
PUSHER_PORT=443 | ||
PUSHER_SCHEME=https | ||
PUSHER_APP_CLUSTER=mt1 | ||
|
||
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" | ||
VITE_PUSHER_HOST="${PUSHER_HOST}" | ||
VITE_PUSHER_PORT="${PUSHER_PORT}" | ||
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" | ||
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" | ||
|
||
|
||
|
||
|
||
# Files | ||
MAX_FILE_UPLOAD_SIZE = 5 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Foundation\Application as LaravelApplication; | ||
|
||
class Application extends LaravelApplication{ | ||
|
||
public const APP_VERSION = '1.0.0'; | ||
|
||
public const PHP_MIN_VERSION = '8.1'; | ||
|
||
public function isInstalled(){ | ||
return file_exists(storage_path('installed')); | ||
} | ||
|
||
public function getAppVersion() | ||
{ | ||
return static::APP_VERSION; | ||
} | ||
|
||
public function getPhpMinVersion() | ||
{ | ||
return static::PHP_MIN_VERSION; | ||
} | ||
|
||
public function getRequiredPhpExtensions() | ||
{ | ||
return [ | ||
'openssl', | ||
'pdo', | ||
'mbstring', | ||
'tokenizer', | ||
'xml', | ||
]; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use App\Website\Pages\Installation; | ||
use Closure; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Route; | ||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
class InstallationMiddleware | ||
{ | ||
/** | ||
* Handle an incoming request. | ||
* | ||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next | ||
*/ | ||
public function handle(Request $request, Closure $next): Response | ||
{ | ||
|
||
// Allow livewire update route | ||
if (Route::getCurrentRoute()->uri === 'livewire/update') { | ||
return $next($request); | ||
} | ||
|
||
$installationPage = Installation::getSlug(); | ||
|
||
|
||
if (!app()->isInstalled() && Route::getCurrentRoute()->uri !== $installationPage) { | ||
return redirect($installationPage); | ||
} | ||
|
||
|
||
return $next($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace App\Livewire\Forms\Installation; | ||
|
||
use App\Actions\User\UserCreateAction; | ||
use App\Models\User; | ||
use Illuminate\Support\Facades\DB; | ||
use Livewire\Attributes\Rule; | ||
use Livewire\Form; | ||
|
||
class AccountForm extends Form | ||
{ | ||
#[Rule('required')] | ||
public $given_name = 'Rahman'; | ||
|
||
#[Rule('required')] | ||
public $family_name = 'Ramsi'; | ||
|
||
#[Rule('required|email')] | ||
public $email = '[email protected]'; | ||
|
||
#[Rule('required|confirmed')] | ||
public $password = 'password'; | ||
|
||
#[Rule('required')] | ||
public $password_confirmation = 'password'; | ||
|
||
public function createAccount() | ||
{ | ||
try { | ||
DB::beginTransaction(); | ||
dd($this->only(['email'])); | ||
User::updateOrCreate( | ||
$this->only(['given_name', 'family_name', 'password']), | ||
$this->only(['email']), | ||
); | ||
|
||
DB::commit(); | ||
} catch (\Throwable $th) { | ||
DB::rollBack(); | ||
|
||
throw $th; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace App\Livewire\Forms\Installation; | ||
|
||
use Livewire\Attributes\Rule; | ||
use Livewire\Form; | ||
|
||
class ConferenceForm extends Form | ||
{ | ||
#[Rule('required')] | ||
public $name = null; | ||
|
||
#[Rule('required')] | ||
public $type = 'Offline'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
|
||
namespace App\Livewire\Forms\Installation; | ||
|
||
use App\Utils\EnvironmentManager; | ||
use Illuminate\Support\Facades\Artisan; | ||
use Illuminate\Support\Facades\Config; | ||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Validation\ValidationException; | ||
use Livewire\Attributes\Rule; | ||
use Livewire\Form; | ||
|
||
class DatabaseForm extends Form | ||
{ | ||
#[Rule('required')] | ||
public $connection = 'mysql'; | ||
|
||
#[Rule('required')] | ||
public $username = 'root_db'; | ||
|
||
#[Rule('required')] | ||
public $password = 'password'; | ||
|
||
#[Rule('required')] | ||
public $name = 'conf'; | ||
|
||
#[Rule('required')] | ||
public $host = '127.0.0.1'; | ||
|
||
#[Rule('required')] | ||
public $port = '3306'; | ||
|
||
|
||
public function checkConnection() | ||
{ | ||
$connection = $this->connection; | ||
|
||
$settings = config("database.connections.$connection"); | ||
|
||
$connectionArray = array_merge($settings, [ | ||
'driver' => $connection, | ||
'database' => $this->name, | ||
]); | ||
|
||
if (!empty($this->username) && !empty($this->password)) { | ||
$connectionArray = array_merge($connectionArray, [ | ||
'username' => $this->username, | ||
'password' => $this->password, | ||
'host' => $this->host, | ||
'port' => $this->port, | ||
]); | ||
} | ||
|
||
|
||
Config::set("database.connections.$connection", $connectionArray); | ||
|
||
try { | ||
// reconnect to database with new settings | ||
DB::reconnect(); | ||
return DB::connection()->getPdo(); | ||
} catch (\Throwable $th) { | ||
$this->addError('checkConnection', $th->getMessage()); | ||
|
||
return false; | ||
} | ||
|
||
} | ||
|
||
public function migrate() | ||
{ | ||
Artisan::call('optimize:clear'); | ||
|
||
if (app(EnvironmentManager::class)->writeEnvWithCurrentConfiguration()) { | ||
Artisan::call('key:generate --force'); | ||
Artisan::call('optimize:clear'); | ||
Artisan::call('storage:link'); | ||
Artisan::call('migrate:fresh --force --seed'); | ||
} | ||
} | ||
|
||
public function process() | ||
{ | ||
if(!$this->checkConnection()) return false; | ||
|
||
$this->migrate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ class AppServiceProvider extends ServiceProvider | |
*/ | ||
public function register(): void | ||
{ | ||
// | ||
|
||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.