diff --git a/app/Http/Controllers/Company/Store.php b/app/Http/Controllers/Company/Store.php index c8afa5618..f28a3ebd9 100644 --- a/app/Http/Controllers/Company/Store.php +++ b/app/Http/Controllers/Company/Store.php @@ -2,7 +2,8 @@ namespace App\Http\Controllers\Company; -use App\Jobs\Tenant\CreateDBs; +use App\Jobs\Tenant\CreateDB; +use App\Jobs\Tenant\Migration; use App\Jobs\Tenant\Migrations; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Routing\Controller; @@ -42,9 +43,9 @@ public function __invoke(ValidateCompany $request, Company $company) $c->save(); } - CreateDBs::dispatch($company, $user_id); + CreateDB::dispatch($company, $user_id); // $company = Company::find($company->id); - Migrations::dispatch($company, $user_id, $person_name, $user_email); + Migration::dispatch($company, $user_id, $person_name, $user_email); return [ 'message' => __('The company was successfully created'), 'redirect' => 'administration.companies.edit', @@ -53,5 +54,6 @@ public function __invoke(ValidateCompany $request, Company $company) }else{ return ['error' => __('Unauthorized')]; } + } } diff --git a/app/Jobs/Tenant/Migrations.php b/app/Jobs/Tenant/Migrations.php index 294303b23..ad45ab794 100644 --- a/app/Jobs/Tenant/Migrations.php +++ b/app/Jobs/Tenant/Migrations.php @@ -73,7 +73,7 @@ public function handle() $em = $this->email; $na = $this->name; $person = $tenants->run(function () use ($em, $na) { - return Person::create([ + return Person::create([ 'email'=>$em, 'name' => $na, @@ -82,7 +82,7 @@ public function handle() \Log::debug($person); \Log::debug('person created'); $user_group = 1; - $user_group = $tenants->run(function () use ($em, $na) { + $user_group = $tenants->run(function () { return UserGroup::create([ 'name'=>'Administrators', 'description' => 'Administrator users group', @@ -91,7 +91,7 @@ public function handle() }); // get role_id // $role = 1; - $role = $tenants->run(function () use ($em, $na) { + $role = $tenants->run(function () { return Role::create([ 'name'=>'Admin', 'menu_id '=>null, diff --git a/app/Models/Company.php b/app/Models/Company.php index 74a2e6458..b3655b42d 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -10,5 +10,4 @@ class Company extends CoreCompany { use CreatedBy; - } diff --git a/app/Models/Person.php b/app/Models/Person.php index 2818bbd17..28e988ea4 100644 --- a/app/Models/Person.php +++ b/app/Models/Person.php @@ -147,9 +147,9 @@ public static function bootUpdatedBy() public function setUpdatedBy() { - if (!is_dir(storage_path('app/public'))) { + if (! is_dir(storage_path('app/public'))) { // dir doesn't exist, make it - \File::makeDirectory(storage_path().'/'.'app/public',0777,true); + \File::makeDirectory(storage_path().'/'.'app/public', 0777, true); // mkdir(storage_path('app/public/'), 0700); } diff --git a/app/Traits/CreatedBy.php b/app/Traits/CreatedBy.php index d362fa455..69ea4a65a 100644 --- a/app/Traits/CreatedBy.php +++ b/app/Traits/CreatedBy.php @@ -21,7 +21,7 @@ public function createdBy(): Relation return $this->belongsTo($userModel, 'created_by'); } - private function setCreatedBy($value=1) + private function setCreatedBy($value = 1) { // if($value==''){ // if (Auth::check()) { @@ -30,8 +30,8 @@ private function setCreatedBy($value=1) // }else{ $this->created_by = 1; // } - } + public static function bootUpdatedBy() { self::creating(fn ($model) => $model->setUpdatedBy()); @@ -51,8 +51,7 @@ private function setUpdatedBy($value=null) // $this->updated_by = Auth::id(); // } // }else{ - $this->updated_by = $value; + $this->updated_by = $value; // } - } } diff --git a/app/Traits/TenantConnectionResolver.php b/app/Traits/TenantConnectionResolver.php index 9972d9a45..23d3d0a63 100644 --- a/app/Traits/TenantConnectionResolver.php +++ b/app/Traits/TenantConnectionResolver.php @@ -22,7 +22,6 @@ public function getConnectionName() } } - return $this->connection; } } diff --git a/config/cors.php b/config/cors.php index 8492f7115..c9e7e8715 100644 --- a/config/cors.php +++ b/config/cors.php @@ -20,14 +20,14 @@ 'allowed_methods' => ['*'], 'allowed_origins' => [ - 'http://pusher.com', + 'http://pusher.com', 'https://pusher.com', 'http://localhost:8080', 'http://localhost:3000', 'http://localhost:8000', 'https://familytree365.com', 'https://api.familytree365.com', - 'https://www.familytree365.com',], + 'https://www.familytree365.com', ], 'allowed_origins_patterns' => [], diff --git a/database/migrations/tenant/2017_01_01_113000_create_avatars_table.php b/database/migrations/tenant/2017_01_01_113000_create_avatars_table.php index 0c80eda04..ddccf1df1 100644 --- a/database/migrations/tenant/2017_01_01_113000_create_avatars_table.php +++ b/database/migrations/tenant/2017_01_01_113000_create_avatars_table.php @@ -7,7 +7,6 @@ class CreateAvatarsTable extends Migration { public function up() - { Schema::create('avatars', function (Blueprint $table) { $table->increments('id'); diff --git a/database/migrations/tenant/2018_08_25_100000_create_files_table.php b/database/migrations/tenant/2018_08_25_100000_create_files_table.php index bb1b6b906..3123fb96d 100644 --- a/database/migrations/tenant/2018_08_25_100000_create_files_table.php +++ b/database/migrations/tenant/2018_08_25_100000_create_files_table.php @@ -16,7 +16,7 @@ public function up() $table->integer('type_id')->default(0); $table->string('original_name')->index(); $table->string('saved_name')->index(); - // $table->string('path'); + // $table->string('path'); $table->integer('size'); $table->string('mime_type')->nullable(); diff --git a/routes/api.php b/routes/api.php index 659ed4514..38c4895d4 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1455,7 +1455,6 @@ Route::get('trees/options', [TreesManage::class, 'getOptions']); }); - //Route::get('test/{cid}', function($cid){ // session('current_company_id', $cid); // retrun success;