Browse Source

Add author on some class docblocks

pull/1/head
Nafies Luthfi 8 years ago
parent
commit
79a1e045bf
  1. 2
      app/Entities/BaseRepository.php
  2. 31
      app/Entities/EloquentRepository.php
  3. 7
      app/Entities/ReferenceAbstract.php
  4. 2
      app/Entities/Reports/ReportsRepository.php
  5. 2
      app/Exceptions/ReferenceKeyNotFoundException.php
  6. 5
      app/Policies/EventPolicy.php
  7. 5
      app/Policies/Partners/CustomerPolicy.php
  8. 5
      app/Policies/Partners/VendorPolicy.php
  9. 7
      app/Policies/Projects/ProjectPolicy.php
  10. 5
      app/Policies/UserPolicy.php
  11. 13
      app/Queries/AdminDashboardQuery.php
  12. 5
      app/Services/Facades/Option.php
  13. 4
      app/Services/InvoiceDraft/InvoiceDraft.php
  14. 6
      app/Services/InvoiceDraft/InvoiceDraftCollection.php
  15. 4
      app/Services/InvoiceDraft/Item.php
  16. 2
      app/Services/Option.php

2
app/Entities/BaseRepository.php

@ -10,6 +10,8 @@ use App\Entities\Users\User;
/**
* Base Repository Class
*
* @author Nafies Luthfi <nafiesL@gmail.com>
*/
abstract class BaseRepository extends EloquentRepository
{

31
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 <nafiesL@gmail.com>
*/
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();

7
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 <nafiesL@gmail.com>
*/
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];
}

2
app/Entities/Reports/ReportsRepository.php

@ -9,6 +9,8 @@ use DB;
/**
* Reports Repository Class
*
* @author Nafies Luthfi <nafiesL@gmail.com>
*/
class ReportsRepository extends BaseRepository
{

2
app/Exceptions/ReferenceKeyNotFoundException.php

@ -4,6 +4,8 @@ namespace App\Exceptions;
/**
* Reference Key Not Found Exception
*
* @author Nafies Luthfi <nafiesL@gmail.com>
*/
class ReferenceKeyNotFoundException extends \RuntimeException
{}

5
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 <nafiesL@gmail.com>
*/
class EventPolicy
{
use HandlesAuthorization;

5
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 <nafiesL@gmail.com>
*/
class CustomerPolicy
{
use HandlesAuthorization;

5
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 <nafiesL@gmail.com>
*/
class VendorPolicy
{
use HandlesAuthorization;

7
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 <nafiesL@gmail.com>
*/
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;
}
/**

5
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 <nafiesL@gmail.com>
*/
class UserPolicy
{
use HandlesAuthorization;

13
app/Queries/AdminDashboardQuery.php

@ -9,6 +9,8 @@ use Carbon\Carbon;
/**
* AdminDashboardQuery
*
* @author Nafies Luthfi <nafiesL@gmail.com>
*/
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();

5
app/Services/Facades/Option.php

@ -4,6 +4,11 @@ namespace App\Services\Facades;
use Illuminate\Support\Facades\Facade;
/**
* Option facade class
*
* @author Nafies Luthfi <nafiesL@gmail.com>
*/
class Option extends Facade
{
protected static function getFacadeAccessor() { return 'option'; }

4
app/Services/InvoiceDraft/InvoiceDraft.php

@ -6,6 +6,8 @@ use App\Entities\Invoices\Invoice;
/**
* Invoice Draft.
*
* @author Nafies Luthfi <nafiesL@gmail.com>
*/
class InvoiceDraft
{
@ -47,7 +49,7 @@ class InvoiceDraft
public function updateItem($itemKey, $newItemData)
{
if ( ! isset($this->items[$itemKey])) {
if (!isset($this->items[$itemKey])) {
return;
}

6
app/Services/InvoiceDraft/InvoiceDraftCollection.php

@ -6,6 +6,8 @@ use Illuminate\Support\Collection;
/**
* InvoiceDraft Collection Class.
*
* @author Nafies Luthfi <nafiesL@gmail.com>
*/
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);

4
app/Services/InvoiceDraft/Item.php

@ -4,6 +4,8 @@ namespace App\Services\InvoiceDrafts;
/**
* Draft Item class.
*
* @author Nafies Luthfi <nafiesL@gmail.com>
*/
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)

2
app/Services/Option.php

@ -6,6 +6,8 @@ use App\Entities\Options\Option as SiteOption;
/**
* Option Class (Site Option Service)
*
* @author Nafies Luthfi <nafiesL@gmail.com>
*/
class Option
{

Loading…
Cancel
Save