diff --git a/app/Entities/BaseRepository.php b/app/Entities/BaseRepository.php index 0b4e126..0043165 100755 --- a/app/Entities/BaseRepository.php +++ b/app/Entities/BaseRepository.php @@ -10,6 +10,8 @@ use App\Entities\Users\User; /** * Base Repository Class + * + * @author Nafies Luthfi */ abstract class BaseRepository extends EloquentRepository { diff --git a/app/Entities/EloquentRepository.php b/app/Entities/EloquentRepository.php index 220c93e..2637651 100755 --- a/app/Entities/EloquentRepository.php +++ b/app/Entities/EloquentRepository.php @@ -6,8 +6,10 @@ use App\Exceptions\EntityNotFoundException; use Illuminate\Database\Eloquent\Model; /** -* Eloquent Repository Class -*/ + * Eloquent Repository Class + * + * @author Nafies Luthfi + */ abstract class EloquentRepository { protected $_paginate = 25; @@ -26,7 +28,7 @@ abstract class EloquentRepository public function getAll($q) { return $this->model->latest() - ->where('name','like','%'.$q.'%') + ->where('name', 'like', '%'.$q.'%') ->paginate($this->_paginate); } @@ -38,8 +40,9 @@ abstract class EloquentRepository public function getBy($column, $value) { $model = $this->model->newQuery()->where($column, $value)->get(); - if ($model->count() > 1) + if ($model->count() > 1) { return $model; + } return $model->first(); } @@ -47,8 +50,10 @@ abstract class EloquentRepository public function requireById($id) { $model = $this->getById($id); - if ( ! $model ) + if (!$model) { throw new EntityNotFoundException($id, $this->model->getTable()); + } + return $model; } @@ -59,12 +64,14 @@ abstract class EloquentRepository public function create($data) { - if ($data instanceof Model) - { + if ($data instanceof Model) { return $this->storeEloquentModel($data); } else { foreach ($data as $key => $value) { - if ($data[$key] == '') $data[$key] = null; + if ($data[$key] == '') { + $data[$key] = null; + } + } return $this->storeArray($data); } @@ -73,7 +80,10 @@ abstract class EloquentRepository public function update($data = [], $modelId) { foreach ($data as $key => $value) { - if (!$data[$key]) $data[$key] = null; + if (!$data[$key]) { + $data[$key] = null; + } + } $model = $this->requireById($modelId); @@ -89,8 +99,7 @@ abstract class EloquentRepository protected function storeEloquentModel(Model $model) { - if ($model->getDirty()) - { + if ($model->getDirty()) { return $model->save(); } else { return $model->touch(); diff --git a/app/Entities/ReferenceAbstract.php b/app/Entities/ReferenceAbstract.php index 3a9ac26..61c4fad 100644 --- a/app/Entities/ReferenceAbstract.php +++ b/app/Entities/ReferenceAbstract.php @@ -5,6 +5,11 @@ namespace App\Entities; use App\Exceptions\ReferenceKeyNotFoundException; use Illuminate\Support\Arr; +/** + * Base of References class + * + * @author Nafies Luthfi + */ abstract class ReferenceAbstract { protected static $lists = []; @@ -52,7 +57,7 @@ abstract class ReferenceAbstract public static function getColorById($colorId) { - if ( ! ! static::getById($colorId) && isset(static::$colors[$colorId])) { + if (!!static::getById($colorId) && isset(static::$colors[$colorId])) { return static::$colors[$colorId]; } diff --git a/app/Entities/Reports/ReportsRepository.php b/app/Entities/Reports/ReportsRepository.php index 6bdd2c5..93dbb9c 100755 --- a/app/Entities/Reports/ReportsRepository.php +++ b/app/Entities/Reports/ReportsRepository.php @@ -9,6 +9,8 @@ use DB; /** * Reports Repository Class + * + * @author Nafies Luthfi */ class ReportsRepository extends BaseRepository { diff --git a/app/Exceptions/ReferenceKeyNotFoundException.php b/app/Exceptions/ReferenceKeyNotFoundException.php index 400a141..3ec979d 100644 --- a/app/Exceptions/ReferenceKeyNotFoundException.php +++ b/app/Exceptions/ReferenceKeyNotFoundException.php @@ -4,6 +4,8 @@ namespace App\Exceptions; /** * Reference Key Not Found Exception + * + * @author Nafies Luthfi */ class ReferenceKeyNotFoundException extends \RuntimeException {} diff --git a/app/Policies/EventPolicy.php b/app/Policies/EventPolicy.php index da75d1d..ade9380 100644 --- a/app/Policies/EventPolicy.php +++ b/app/Policies/EventPolicy.php @@ -6,6 +6,11 @@ use App\Entities\Users\Event; use App\Entities\Users\User; use Illuminate\Auth\Access\HandlesAuthorization; +/** + * Event model policy class + * + * @author Nafies Luthfi + */ class EventPolicy { use HandlesAuthorization; diff --git a/app/Policies/Partners/CustomerPolicy.php b/app/Policies/Partners/CustomerPolicy.php index f5d9322..e8f9cd2 100644 --- a/app/Policies/Partners/CustomerPolicy.php +++ b/app/Policies/Partners/CustomerPolicy.php @@ -6,6 +6,11 @@ use App\Entities\Partners\Customer; use App\Entities\Users\User; use Illuminate\Auth\Access\HandlesAuthorization; +/** + * Customer model policy class + * + * @author Nafies Luthfi + */ class CustomerPolicy { use HandlesAuthorization; diff --git a/app/Policies/Partners/VendorPolicy.php b/app/Policies/Partners/VendorPolicy.php index 3ebef38..c765ae1 100644 --- a/app/Policies/Partners/VendorPolicy.php +++ b/app/Policies/Partners/VendorPolicy.php @@ -6,6 +6,11 @@ use App\Entities\Partners\Vendor; use App\Entities\Users\User; use Illuminate\Auth\Access\HandlesAuthorization; +/** + * Vendor model policy class + * + * @author Nafies Luthfi + */ class VendorPolicy { use HandlesAuthorization; diff --git a/app/Policies/Projects/ProjectPolicy.php b/app/Policies/Projects/ProjectPolicy.php index f063e06..18f725d 100644 --- a/app/Policies/Projects/ProjectPolicy.php +++ b/app/Policies/Projects/ProjectPolicy.php @@ -6,6 +6,11 @@ use App\Entities\Projects\Project; use App\Entities\Users\User; use Illuminate\Auth\Access\HandlesAuthorization; +/** + * Project model policy class + * + * @author Nafies Luthfi + */ class ProjectPolicy { use HandlesAuthorization; @@ -33,7 +38,7 @@ class ProjectPolicy public function create(User $user, Project $project) { // User can create a project if they owns an agency. - return true; + return true; } /** diff --git a/app/Policies/UserPolicy.php b/app/Policies/UserPolicy.php index c852b2d..703f15a 100644 --- a/app/Policies/UserPolicy.php +++ b/app/Policies/UserPolicy.php @@ -6,6 +6,11 @@ use App\Entities\Users\User; use App\Entities\Users\User as Worker; use Illuminate\Auth\Access\HandlesAuthorization; +/** + * User model policy class + * + * @author Nafies Luthfi + */ class UserPolicy { use HandlesAuthorization; diff --git a/app/Queries/AdminDashboardQuery.php b/app/Queries/AdminDashboardQuery.php index 9c6c8e9..0e34e29 100644 --- a/app/Queries/AdminDashboardQuery.php +++ b/app/Queries/AdminDashboardQuery.php @@ -9,6 +9,8 @@ use Carbon\Carbon; /** * AdminDashboardQuery + * + * @author Nafies Luthfi */ class AdminDashboardQuery { @@ -43,6 +45,12 @@ class AdminDashboardQuery return Project::where('status_id', 4)->where('start_date', 'like', $year.'%')->count(); } + /** + * Get current outstanding customer payment amount + * + * @param string|integer $year Year of queried payment records + * @return integer Amount of outstanding customer payment + */ public function currentOutstandingCustomerPayment($year) { // On Progress, Done, On Hold @@ -64,6 +72,11 @@ class AdminDashboardQuery return $oustandingPaymentTotal; } + /** + * Get list of customer subscriptions that expires on next 60 days + * + * @return \Illuminate\Support\Collection Collection of filtered subscriptions + */ public function upcomingSubscriptionDueDatesList() { $subscriptions = Subscription::get(); diff --git a/app/Services/Facades/Option.php b/app/Services/Facades/Option.php index 75d6127..43f83b1 100644 --- a/app/Services/Facades/Option.php +++ b/app/Services/Facades/Option.php @@ -4,6 +4,11 @@ namespace App\Services\Facades; use Illuminate\Support\Facades\Facade; +/** + * Option facade class + * + * @author Nafies Luthfi + */ class Option extends Facade { protected static function getFacadeAccessor() { return 'option'; } diff --git a/app/Services/InvoiceDraft/InvoiceDraft.php b/app/Services/InvoiceDraft/InvoiceDraft.php index f97bbc2..1018e86 100644 --- a/app/Services/InvoiceDraft/InvoiceDraft.php +++ b/app/Services/InvoiceDraft/InvoiceDraft.php @@ -6,6 +6,8 @@ use App\Entities\Invoices\Invoice; /** * Invoice Draft. + * + * @author Nafies Luthfi */ class InvoiceDraft { @@ -47,7 +49,7 @@ class InvoiceDraft public function updateItem($itemKey, $newItemData) { - if ( ! isset($this->items[$itemKey])) { + if (!isset($this->items[$itemKey])) { return; } diff --git a/app/Services/InvoiceDraft/InvoiceDraftCollection.php b/app/Services/InvoiceDraft/InvoiceDraftCollection.php index 838a765..fe83b2a 100644 --- a/app/Services/InvoiceDraft/InvoiceDraftCollection.php +++ b/app/Services/InvoiceDraft/InvoiceDraftCollection.php @@ -6,6 +6,8 @@ use Illuminate\Support\Collection; /** * InvoiceDraft Collection Class. + * + * @author Nafies Luthfi */ class InvoiceDraftCollection { @@ -34,7 +36,7 @@ class InvoiceDraftCollection public function add(InvoiceDraft $draft) { - $content = $this->getContent(); + $content = $this->getContent(); $draft->draftKey = str_random(10); $content->put($draft->draftKey, $draft); @@ -56,7 +58,7 @@ class InvoiceDraftCollection $content = $this->getContent(); $content[$draftKey]->projectId = $draftAttributes['project_id']; - $content[$draftKey]->notes = $draftAttributes['notes']; + $content[$draftKey]->notes = $draftAttributes['notes']; $this->session->put($this->instance, $content); diff --git a/app/Services/InvoiceDraft/Item.php b/app/Services/InvoiceDraft/Item.php index e26d710..9599e0a 100644 --- a/app/Services/InvoiceDraft/Item.php +++ b/app/Services/InvoiceDraft/Item.php @@ -4,6 +4,8 @@ namespace App\Services\InvoiceDrafts; /** * Draft Item class. + * + * @author Nafies Luthfi */ class Item { @@ -13,7 +15,7 @@ class Item public function __construct(array $itemDetail) { $this->description = $itemDetail['description']; - $this->amount = $itemDetail['amount']; + $this->amount = $itemDetail['amount']; } public function updateAttribute(array $newItemData) diff --git a/app/Services/Option.php b/app/Services/Option.php index 52a0490..da08c3c 100644 --- a/app/Services/Option.php +++ b/app/Services/Option.php @@ -6,6 +6,8 @@ use App\Entities\Options\Option as SiteOption; /** * Option Class (Site Option Service) + * + * @author Nafies Luthfi */ class Option {