diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php
index 553b869e51a1..54ec44405f52 100644
--- a/app/Repositories/BaseRepository.php
+++ b/app/Repositories/BaseRepository.php
@@ -34,24 +34,6 @@ class BaseRepository
use MakesHash;
use SavesDocuments;
- /**
- * @return null
- */
- public function getClassName()
- {
- return null;
- }
-
- /**
- * @return mixed
- */
- private function getInstance()
- {
- $className = $this->getClassName();
-
- return new $className();
- }
-
/**
* @param $entity
* @param $type
@@ -153,25 +135,6 @@ class BaseRepository
return count($entities);
}
- /**
- * @param $ids
- *
- * @return mixed
- */
- public function findByPublicIds($ids)
- {
- return $this->getInstance()->scope($ids)->get();
- }
-
- /**
- * @param $ids
- *
- * @return mixed
- */
- public function findByPublicIdsWithTrashed($ids)
- {
- return $this->getInstance()->scope($ids)->withTrashed()->get();
- }
public function getInvitation($invitation, $resource)
{
diff --git a/app/Repositories/ClientRepository.php b/app/Repositories/ClientRepository.php
index 806fa4ba553e..e4924f387f7e 100644
--- a/app/Repositories/ClientRepository.php
+++ b/app/Repositories/ClientRepository.php
@@ -39,17 +39,7 @@ class ClientRepository extends BaseRepository
{
$this->contact_repo = $contact_repo;
}
-
- /**
- * Gets the class name.
- *
- * @return string The class name.
- */
- public function getClassName()
- {
- return Client::class;
- }
-
+
/**
* Saves the client and its contacts.
*
diff --git a/app/Repositories/CompanyRepository.php b/app/Repositories/CompanyRepository.php
index 296e3fba29a7..b68df6b6e342 100644
--- a/app/Repositories/CompanyRepository.php
+++ b/app/Repositories/CompanyRepository.php
@@ -23,16 +23,6 @@ class CompanyRepository extends BaseRepository
{
}
- /**
- * Gets the class name.
- *
- * @return string The class name.
- */
- public function getClassName()
- {
- return Company::class;
- }
-
/**
* Saves the client and its contacts.
*
diff --git a/app/Repositories/CreditRepository.php b/app/Repositories/CreditRepository.php
index dd2963a316a1..5092fc8881ab 100644
--- a/app/Repositories/CreditRepository.php
+++ b/app/Repositories/CreditRepository.php
@@ -30,15 +30,6 @@ class CreditRepository extends BaseRepository
{
}
- /**
- * Gets the class name.
- *
- * @return string The class name.
- */
- public function getClassName()
- {
- return Credit::class;
- }
/**
* Saves the client and its contacts.
diff --git a/app/Repositories/DesignRepository.php b/app/Repositories/DesignRepository.php
index 353774e999d0..97a53dd8734e 100644
--- a/app/Repositories/DesignRepository.php
+++ b/app/Repositories/DesignRepository.php
@@ -11,30 +11,10 @@
namespace App\Repositories;
-use App\Libraries\MultiDB;
-use App\Models\Activity;
-use App\Models\Backup;
-use App\Models\Client;
-use App\Models\Design;
-use App\Models\Invoice;
-use App\Models\User;
-use App\Utils\Traits\MakesInvoiceHtml;
-use Illuminate\Support\Facades\Log;
-
/**
- * Class for activity repository.
+ * Class for DesignRepository .
*/
class DesignRepository extends BaseRepository
{
- use MakesInvoiceHtml;
- /**
- * Gets the class name.
- *
- * @return string The class name.
- */
- public function getClassName()
- {
- return Design::class;
- }
}
diff --git a/app/Repositories/DocumentRepository.php b/app/Repositories/DocumentRepository.php
index 595fcc732dab..1c60366f618f 100644
--- a/app/Repositories/DocumentRepository.php
+++ b/app/Repositories/DocumentRepository.php
@@ -19,15 +19,6 @@ use App\Utils\Ninja;
*/
class DocumentRepository extends BaseRepository
{
- /**
- * Gets the class name.
- *
- * @return string The class name.
- */
- public function getClassName()
- {
- return Document::class;
- }
public function delete($document)
{
diff --git a/app/Repositories/ExpenseRepository.php b/app/Repositories/ExpenseRepository.php
index 0044514ffbdd..310a9315aad5 100644
--- a/app/Repositories/ExpenseRepository.php
+++ b/app/Repositories/ExpenseRepository.php
@@ -24,19 +24,6 @@ class ExpenseRepository extends BaseRepository
{
use GeneratesCounter;
- public function __construct()
- {
- }
-
- /**
- * Gets the class name.
- *
- * @return string The class name.
- */
- public function getClassName()
- {
- return Expense::class;
- }
/**
* Saves the expense and its contacts.
diff --git a/app/Repositories/GroupSettingRepository.php b/app/Repositories/GroupSettingRepository.php
index fd0ebb4d9ce9..d1aac1dda4d9 100644
--- a/app/Repositories/GroupSettingRepository.php
+++ b/app/Repositories/GroupSettingRepository.php
@@ -12,21 +12,9 @@
namespace App\Repositories;
use App\Models\GroupSetting;
-use App\Utils\Traits\MakesHash;
class GroupSettingRepository extends BaseRepository
{
- use MakesHash;
-
- /**
- * Gets the class name.
- *
- * @return string The class name.
- */
- public function getClassName()
- {
- return GroupSetting::class;
- }
public function save($data, GroupSetting $group_setting) :?GroupSetting
{
diff --git a/app/Repositories/InvoiceRepository.php b/app/Repositories/InvoiceRepository.php
index a6d00636803e..8a286902917b 100644
--- a/app/Repositories/InvoiceRepository.php
+++ b/app/Repositories/InvoiceRepository.php
@@ -27,23 +27,14 @@ class InvoiceRepository extends BaseRepository
{
use MakesHash;
- /**
- * Gets the class name.
- *
- * @return string The class name.
- */
- public function getClassName()
- {
- return Invoice::class;
- }
/**
* Saves the invoices.
*
- * @param array. $data The invoice data
- * @param InvoiceSum|Invoice $invoice The invoice
+ * @param array $data The invoice data
+ * @param Invoice $invoice The invoice
*
- * @return Invoice|InvoiceSum|null Returns the invoice object
+ * @return Invoice|null Returns the invoice object
*/
public function save($data, Invoice $invoice):?Invoice
{
diff --git a/app/Repositories/Migration/PaymentMigrationRepository.php b/app/Repositories/Migration/PaymentMigrationRepository.php
index 632c5ef47932..197e4eaac9ce 100644
--- a/app/Repositories/Migration/PaymentMigrationRepository.php
+++ b/app/Repositories/Migration/PaymentMigrationRepository.php
@@ -48,11 +48,6 @@ class PaymentMigrationRepository extends BaseRepository
$this->activity_repo = new ActivityRepository();
}
- public function getClassName()
- {
- return Payment::class;
- }
-
/**
* Saves and updates a payment. //todo refactor to handle refunds and payments.
*
diff --git a/app/Repositories/PaymentRepository.php b/app/Repositories/PaymentRepository.php
index b83851a1ea39..de63f2472b25 100644
--- a/app/Repositories/PaymentRepository.php
+++ b/app/Repositories/PaymentRepository.php
@@ -41,15 +41,6 @@ class PaymentRepository extends BaseRepository
$this->credit_repo = $credit_repo;
}
- /**
- * @return string
- */
-
- public function getClassName()
- {
- return Payment::class;
- }
-
/**
* Saves and updates a payment. //todo refactor to handle refunds and payments.
*
diff --git a/app/Repositories/ProductRepository.php b/app/Repositories/ProductRepository.php
index 350c7ebc39da..c5c8a1e7c0af 100644
--- a/app/Repositories/ProductRepository.php
+++ b/app/Repositories/ProductRepository.php
@@ -19,11 +19,6 @@ class ProductRepository extends BaseRepository
{
use SavesDocuments;
- public function getClassName()
- {
- return Product::class;
- }
-
/**
* @param array $data
* @param Product $product
diff --git a/app/Repositories/ProjectRepository.php b/app/Repositories/ProjectRepository.php
index b1010bf71d65..136ecadf9e55 100644
--- a/app/Repositories/ProjectRepository.php
+++ b/app/Repositories/ProjectRepository.php
@@ -19,13 +19,4 @@ use App\Models\Project;
class ProjectRepository extends BaseRepository
{
- /**
- * Gets the class name.
- *
- * @return string The class name.
- */
- public function getClassName()
- {
- return Project::class;
- }
}
diff --git a/app/Repositories/QuoteRepository.php b/app/Repositories/QuoteRepository.php
index e0e70424fd6a..33aa4e34e554 100644
--- a/app/Repositories/QuoteRepository.php
+++ b/app/Repositories/QuoteRepository.php
@@ -27,12 +27,7 @@ use Illuminate\Http\Request;
*/
class QuoteRepository extends BaseRepository
{
- use MakesHash;
- public function getClassName()
- {
- return Quote::class;
- }
public function save($data, Quote $quote) : ?Quote
{
diff --git a/app/Repositories/RecurringInvoiceRepository.php b/app/Repositories/RecurringInvoiceRepository.php
index 7ef4d778ab36..9658caaaa533 100644
--- a/app/Repositories/RecurringInvoiceRepository.php
+++ b/app/Repositories/RecurringInvoiceRepository.php
@@ -20,10 +20,6 @@ use Illuminate\Http\Request;
*/
class RecurringInvoiceRepository extends BaseRepository
{
- public function getClassName()
- {
- return RecurringInvoice::class;
- }
public function save($data, RecurringInvoice $invoice) : ?RecurringInvoice
{
diff --git a/app/Repositories/RecurringQuoteRepository.php b/app/Repositories/RecurringQuoteRepository.php
index 65e218e28dbe..a0894e8f3a9d 100644
--- a/app/Repositories/RecurringQuoteRepository.php
+++ b/app/Repositories/RecurringQuoteRepository.php
@@ -20,10 +20,7 @@ use Illuminate\Http\Request;
*/
class RecurringQuoteRepository extends BaseRepository
{
- public function getClassName()
- {
- return RecurringQuote::class;
- }
+
public function save(Request $request, RecurringQuote $quote) : ?RecurringQuote
{
@@ -31,13 +28,10 @@ class RecurringQuoteRepository extends BaseRepository
$quote->save();
- $quote_calc = new InvoiceSum($quote, $quote->settings);
+ $quote_calc = new InvoiceSum($quote);
$quote = $quote_calc->build()->getQuote();
- //fire events here that cascading from the saving of an Quote
- //ie. client balance update...
-
return $quote;
}
}
diff --git a/app/Repositories/TaskRepository.php b/app/Repositories/TaskRepository.php
index 639567c25686..75f0e7817570 100644
--- a/app/Repositories/TaskRepository.php
+++ b/app/Repositories/TaskRepository.php
@@ -23,19 +23,6 @@ class TaskRepository extends BaseRepository
{
use GeneratesCounter;
- public function __construct()
- {
- }
-
- /**
- * Gets the class name.
- *
- * @return string The class name.
- */
- public function getClassName()
- {
- return Task::class;
- }
/**
* Saves the task and its contacts.
diff --git a/app/Repositories/TokenRepository.php b/app/Repositories/TokenRepository.php
index 39a559f376b1..aef6e1e20f44 100644
--- a/app/Repositories/TokenRepository.php
+++ b/app/Repositories/TokenRepository.php
@@ -15,15 +15,7 @@ use App\Models\CompanyToken;
class TokenRepository extends BaseRepository
{
- /**
- * Gets the class name.
- *
- * @return string The class name.
- */
- public function getClassName()
- {
- return CompanyToken::class;
- }
+
/**
* Saves the companytoken.
diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php
index dfa0c531a117..6a55bd1aa5a6 100644
--- a/app/Repositories/UserRepository.php
+++ b/app/Repositories/UserRepository.php
@@ -27,24 +27,15 @@ class UserRepository extends BaseRepository
{
use MakesHash;
- /**
- * Gets the class name.
- *
- * @return string The class name.
- */
- public function getClassName()
- {
- return User::class;
- }
/**
* Saves the user and its contacts.
*
* @param array $data The data
- * @param \App\Models\user $user The user
+ * @param \App\Models\User $user The user
*
* @param bool $unset_company_user
- * @return user|\App\Models\user|null user Object
+ * @return \App\Models\User user Object
*/
public function save(array $data, User $user, $unset_company_user = false)
{
diff --git a/app/Repositories/VendorRepository.php b/app/Repositories/VendorRepository.php
index 165478c7e5ff..9b15eb5a3f5f 100644
--- a/app/Repositories/VendorRepository.php
+++ b/app/Repositories/VendorRepository.php
@@ -13,7 +13,7 @@ namespace App\Repositories;
use App\Factory\VendorFactory;
use App\Models\Vendor;
-use App\Repositories\VSendorContactRepository;
+use App\Repositories\VendorContactRepository;
use App\Utils\Traits\GeneratesCounter;
use Illuminate\Http\Request;
@@ -23,37 +23,24 @@ use Illuminate\Http\Request;
class VendorRepository extends BaseRepository
{
use GeneratesCounter;
- /**
- * @var vendorContactRepository
- */
+
protected $contact_repo;
/**
- * vendorController constructor.
- * @param vendorContactRepository $contact_repo
+ * VendorContactRepository constructor.
*/
public function __construct(VendorContactRepository $contact_repo)
{
$this->contact_repo = $contact_repo;
}
- /**
- * Gets the class name.
- *
- * @return string The class name.
- */
- public function getClassName()
- {
- return Vendor::class;
- }
-
/**
* Saves the vendor and its contacts.
*
* @param array $data The data
- * @param \App\Models\vendor $vendor The vendor
+ * @param \App\Models\Vendor $vendor The vendor
*
- * @return vendor|\App\Models\vendor|null vendor Object
+ * @return vendor|\App\Models\Vendor|null Vendor Object
* @throws \Laracasts\Presenter\Exceptions\PresenterException
*/
public function save(array $data, Vendor $vendor) : ?Vendor
@@ -70,7 +57,7 @@ class VendorRepository extends BaseRepository
$vendor->save();
if (isset($data['contacts'])) {
- $contacts = $this->contact_repo->save($data, $vendor);
+ $this->contact_repo->save($data, $vendor);
}
if (empty($data['name'])) {
diff --git a/app/Services/Credit/CreateInvitations.php b/app/Services/Credit/CreateInvitations.php
index 4a742effd293..45c7b1bff7a2 100644
--- a/app/Services/Credit/CreateInvitations.php
+++ b/app/Services/Credit/CreateInvitations.php
@@ -40,7 +40,7 @@ class CreateInvitations extends AbstractService
$ii->credit_id = $this->credit->id;
$ii->client_contact_id = $contact->id;
$ii->save();
- } elseif ($invitation && ! $contact->send_email) {
+ } elseif (! $contact->send_email) {
$invitation->delete();
}
});
diff --git a/psalm.xml b/psalm.xml
index 73bb3b38d930..ba56482e2e13 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -61,6 +61,11 @@
+
+
+
+
+