diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php index 1b448f55c1b1..a462cad626e0 100644 --- a/app/Http/Controllers/BaseController.php +++ b/app/Http/Controllers/BaseController.php @@ -11,6 +11,7 @@ namespace App\Http\Controllers; +use App\Models\Company; use App\Models\User; use App\Transformers\ArraySerializer; use App\Transformers\EntityTransformer; @@ -146,12 +147,16 @@ class BaseController extends Controller $query->with($includes); - if (auth()->user()->cannot('view_'.$this->entity_type)) { - if ($this->entity_type == User::class) { + + if($this->entity_type == Company::class){ + //no user keys exist on the company table, so we need to skip + } + else if ($this->entity_type == User::class) { $query->where('id', '=', auth()->user()->id); - } else { + } + else { $query->where('user_id', '=', auth()->user()->id); } } diff --git a/app/Repositories/InvoiceRepository.php b/app/Repositories/InvoiceRepository.php index 8718d783fb39..0ad98a8936d9 100644 --- a/app/Repositories/InvoiceRepository.php +++ b/app/Repositories/InvoiceRepository.php @@ -16,6 +16,7 @@ use App\Events\Invoice\InvoiceWasUpdated; use App\Factory\InvoiceInvitationFactory; use App\Helpers\Invoice\InvoiceCalc; use App\Jobs\Company\UpdateCompanyLedgerWithInvoice; +use App\Listeners\Invoice\CreateInvoiceInvitation; use App\Models\ClientContact; use App\Models\Invoice; use App\Models\InvoiceInvitation; diff --git a/tests/Feature/CompanyTest.php b/tests/Feature/CompanyTest.php index 5851a37f3601..cd18aac9ad79 100644 --- a/tests/Feature/CompanyTest.php +++ b/tests/Feature/CompanyTest.php @@ -47,7 +47,7 @@ class CompanyTest extends TestCase $data = [ 'first_name' => $this->faker->firstName, 'last_name' => $this->faker->lastName, - 'name' => $this->faker->company, + 'name' => $this->faker->company, 'email' => $this->faker->unique()->safeEmail, 'password' => 'ALongAndBrilliantPassword123', '_token' => csrf_token(),