fixed installer
This commit is contained in:
parent
29df87b80b
commit
97a743d1f1
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Utilities;
|
namespace App\Utilities;
|
||||||
|
|
||||||
use App\Models\Auth\User;
|
use App\Jobs\Auth\CreateUser;
|
||||||
use App\Models\Common\Company;
|
use App\Jobs\Common\CreateCompany;
|
||||||
use Artisan;
|
use Artisan;
|
||||||
use Config;
|
use Config;
|
||||||
use DB;
|
use DB;
|
||||||
@ -19,7 +19,6 @@ use Illuminate\Support\Str;
|
|||||||
*/
|
*/
|
||||||
class Installer
|
class Installer
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function checkServerRequirements()
|
public static function checkServerRequirements()
|
||||||
{
|
{
|
||||||
$requirements = [];
|
$requirements = [];
|
||||||
@ -228,42 +227,27 @@ class Installer
|
|||||||
|
|
||||||
public static function createCompany($name, $email, $locale)
|
public static function createCompany($name, $email, $locale)
|
||||||
{
|
{
|
||||||
// Create company
|
dispatch_now(new CreateCompany([
|
||||||
$company = Company::create([
|
'name' => $name,
|
||||||
'domain' => '',
|
'domain' => '',
|
||||||
]);
|
'email' => $email,
|
||||||
|
'currency' => 'USD',
|
||||||
// Set settings
|
'locale' => $locale,
|
||||||
setting()->setExtraColumns(['company_id' => $company->id]);
|
'enabled' => '1',
|
||||||
setting()->set([
|
]));
|
||||||
'company.name' => $name,
|
|
||||||
'company.email' => $email,
|
|
||||||
'default.currency' => 'USD',
|
|
||||||
'default.locale' => $locale,
|
|
||||||
]);
|
|
||||||
setting()->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createUser($email, $password, $locale)
|
public static function createUser($email, $password, $locale)
|
||||||
{
|
{
|
||||||
// Create the user
|
dispatch_now(new CreateUser([
|
||||||
$user = User::create([
|
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'email' => $email,
|
'email' => $email,
|
||||||
'password' => $password,
|
'password' => $password,
|
||||||
'locale' => $locale,
|
'locale' => $locale,
|
||||||
]);
|
'companies' => ['1'],
|
||||||
|
'roles' => ['1'],
|
||||||
// Attach admin role
|
'enabled' => '1',
|
||||||
$user->roles()->attach('1');
|
]));
|
||||||
|
|
||||||
// Attach company
|
|
||||||
$user->companies()->attach('1');
|
|
||||||
|
|
||||||
Artisan::call('user:seed', [
|
|
||||||
'user' => $user->id,
|
|
||||||
'company' => 1
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function finalTouches()
|
public static function finalTouches()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user