Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
curtisdelicata committed Dec 18, 2022
2 parents 223e967 + 02409ff commit 7b9c3df
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 19 deletions.
8 changes: 5 additions & 3 deletions app/Http/Controllers/Company/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand All @@ -53,5 +54,6 @@ public function __invoke(ValidateCompany $request, Company $company)
}else{
return ['error' => __('Unauthorized')];
}

}
}
6 changes: 3 additions & 3 deletions app/Jobs/Tenant/Migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand All @@ -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',
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion app/Models/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
class Company extends CoreCompany
{
use CreatedBy;

}
4 changes: 2 additions & 2 deletions app/Models/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
7 changes: 3 additions & 4 deletions app/Traits/CreatedBy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -30,8 +30,8 @@ private function setCreatedBy($value=1)
// }else{
$this->created_by = 1;
// }

}

public static function bootUpdatedBy()
{
self::creating(fn ($model) => $model->setUpdatedBy());
Expand All @@ -51,8 +51,7 @@ private function setUpdatedBy($value=null)
// $this->updated_by = Auth::id();
// }
// }else{
$this->updated_by = $value;
$this->updated_by = $value;
// }

}
}
1 change: 0 additions & 1 deletion app/Traits/TenantConnectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public function getConnectionName()
}
}


return $this->connection;
}
}
4 changes: 2 additions & 2 deletions config/cors.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [],

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
class CreateAvatarsTable extends Migration
{
public function up()

{
Schema::create('avatars', function (Blueprint $table) {
$table->increments('id');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,6 @@
Route::get('trees/options', [TreesManage::class, 'getOptions']);
});


//Route::get('test/{cid}', function($cid){
// session('current_company_id', $cid);
// retrun success;
Expand Down

0 comments on commit 7b9c3df

Please sign in to comment.