From 9757124dd5a9c6c5b351dfbabdfe5878fec1121a Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 3 Dec 2017 15:04:16 +0000 Subject: [PATCH] Apply fixes from StyleCI --- app/Console/Kernel.php | 3 +- app/Entities/BaseRepository.php | 4 +- app/Entities/EloquentRepository.php | 10 +- app/Entities/Invoices/Invoice.php | 1 + app/Entities/Options/Option.php | 8 +- app/Entities/Payments/Payment.php | 1 - app/Entities/Payments/PaymentPresenter.php | 2 +- app/Entities/Payments/PaymentsRepository.php | 2 +- app/Entities/Projects/Job.php | 4 - app/Entities/Projects/JobPresenter.php | 1 - app/Entities/Projects/JobsRepository.php | 5 +- app/Entities/Projects/Project.php | 3 - app/Entities/Projects/ProjectPresenter.php | 1 - app/Entities/Projects/ProjectsRepository.php | 7 +- app/Entities/Projects/Status.php | 2 +- app/Entities/Projects/Task.php | 3 - app/Entities/Projects/TasksRepository.php | 3 +- app/Entities/ReferenceAbstract.php | 4 +- app/Entities/Reports/ReportsRepository.php | 18 ++-- .../Subscriptions/SubscriptionPresenter.php | 4 +- .../Subscriptions/SubscriptionsRepository.php | 3 +- app/Entities/Users/Event.php | 5 +- app/Entities/Users/Role.php | 2 +- app/Entities/Users/User.php | 16 +-- app/Exceptions/Handler.php | 17 +-- app/Exceptions/ReferenceKeyNotFoundException.php | 5 +- app/Http/Controllers/Api/EventsController.php | 110 ++++++++++---------- app/Http/Controllers/Api/ProjectsController.php | 4 +- .../Controllers/Auth/ChangePasswordController.php | 6 +- app/Http/Controllers/Auth/LoginController.php | 6 +- .../Controllers/Auth/ResetPasswordController.php | 7 +- app/Http/Controllers/BackupsController.php | 3 + app/Http/Controllers/Controller.php | 4 +- app/Http/Controllers/InstallationController.php | 5 +- app/Http/Controllers/Invoices/DraftsController.php | 1 + .../Controllers/Invoices/InvoicesController.php | 1 + app/Http/Controllers/JobsController.php | 3 +- app/Http/Controllers/PagesController.php | 1 - .../Controllers/Partners/CustomersController.php | 19 ++-- .../Controllers/Partners/VendorsController.php | 17 ++- app/Http/Controllers/PaymentsController.php | 7 +- app/Http/Controllers/Projects/FeesController.php | 4 +- app/Http/Controllers/Projects/FilesController.php | 2 +- app/Http/Controllers/Projects/JobsController.php | 1 + .../Controllers/Projects/ProjectsController.php | 15 ++- app/Http/Controllers/Projects/TasksController.php | 4 +- .../Controllers/References/OptionsController.php | 5 +- app/Http/Controllers/ReportsController.php | 7 +- app/Http/Controllers/SubscriptionsController.php | 7 +- app/Http/Controllers/Users/AgencyController.php | 3 +- app/Http/Controllers/Users/ProfileController.php | 3 +- app/Http/Controllers/Users/UsersController.php | 2 +- app/Http/Middleware/Authenticate.php | 7 +- app/Http/Middleware/GlobalViewVariables.php | 5 +- app/Http/Middleware/RedirectIfAuthenticated.php | 7 +- app/Http/Middleware/Role.php | 6 +- app/Http/Requests/Jobs/CreateRequest.php | 2 +- app/Http/Requests/Jobs/DeleteRequest.php | 3 +- app/Http/Requests/Jobs/UpdateRequest.php | 3 +- app/Http/Requests/Payments/CreateRequest.php | 2 - app/Http/Requests/Payments/DeleteRequest.php | 45 ++++---- app/Http/Requests/Payments/UpdateRequest.php | 2 - app/Http/Requests/Projects/CreateRequest.php | 4 +- app/Http/Requests/Projects/DeleteRequest.php | 3 +- app/Http/Requests/Projects/UpdateRequest.php | 3 +- app/Http/Requests/SubscriptionRequest.php | 29 +++--- app/Http/Requests/Tasks/CreateRequest.php | 1 - app/Http/Requests/Tasks/DeleteRequest.php | 2 - app/Http/Requests/Tasks/UpdateRequest.php | 2 - app/Policies/EventPolicy.php | 2 +- app/Policies/Partners/CustomerPolicy.php | 22 ++-- app/Policies/Partners/VendorPolicy.php | 22 ++-- app/Policies/Projects/ProjectPolicy.php | 22 ++-- app/Policies/UserPolicy.php | 22 ++-- app/Providers/AuthServiceProvider.php | 1 - app/Providers/EventServiceProvider.php | 5 +- app/Providers/RouteServiceProvider.php | 8 +- app/Queries/AdminDashboardQuery.php | 28 ++--- app/Services/Facades/Option.php | 9 +- app/Services/InvoiceDraft/InvoiceDraft.php | 3 +- app/Services/InvoiceDraft/Item.php | 2 +- app/Services/Option.php | 8 +- app/helpers.php | 44 +++++--- config/auth.php | 12 +-- config/backup-manager.php | 54 +++++----- config/broadcasting.php | 10 +- config/cache.php | 10 +- config/filesystems.php | 8 +- database/factories/CustomerFactory.php | 2 - database/factories/InvoiceFactory.php | 2 +- database/factories/ModelFactory.php | 3 - database/factories/PaymentFactory.php | 4 - database/factories/ProjectFactory.php | 6 +- database/factories/SubscriptionFactory.php | 13 ++- database/factories/VendorFactory.php | 1 - .../2014_10_12_000000_create_users_table.php | 5 +- ...4_10_12_100000_create_password_resets_table.php | 5 +- ...2015_07_14_131409_create_site_options_table.php | 5 +- .../2016_07_06_110052_create_projects_table.php | 67 ++++++------ ...016_07_08_182606_create_subscriptions_table.php | 1 - .../2016_07_09_093439_create_jobs_table.php | 2 - .../2016_07_09_142833_create_tasks_table.php | 2 - .../2016_11_15_151228_create_payments_table.php | 2 - .../2016_11_25_145359_create_user_events_table.php | 63 ++++++------ .../2017_08_03_235706_create_files_table.php | 4 +- public/index.php | 3 +- resources/lang/en/auth.php | 2 +- resources/lang/en/passwords.php | 8 +- resources/lang/id/option.php | 2 +- resources/lang/id/passwords.php | 10 +- resources/lang/id/permission.php | 2 +- resources/lang/id/role.php | 2 +- resources/lang/id/validation.php | 114 ++++++++++----------- routes/api.php | 8 +- routes/web.php | 2 +- routes/web/account.php | 2 +- routes/web/calendar.php | 9 +- routes/web/invoices.php | 2 +- routes/web/options-vue.php | 26 ++--- routes/web/pages.php | 6 +- routes/web/payments.php | 2 +- routes/web/projects.php | 18 ++-- routes/web/references.php | 2 +- routes/web/reports.php | 2 +- routes/web/users.php | 2 +- server.php | 4 +- tests/Feature/AgencyProfileTest.php | 2 +- tests/Feature/Api/ApiEventsTest.php | 2 +- tests/Feature/Api/ApiManageProjectsTest.php | 2 +- tests/Feature/Auth/ResetPasswordTest.php | 1 - tests/Feature/InstallationTest.php | 2 +- tests/Feature/ManageJobsTest.php | 2 +- tests/Feature/ManageSubscriptionsTest.php | 44 ++++---- tests/Feature/Partners/ManageCustomersTest.php | 6 +- tests/Feature/Payments/ManagePaymentsTest.php | 2 +- tests/Feature/Payments/ManageProjectFeesTest.php | 1 - tests/Feature/Projects/UploadFilesTest.php | 4 +- tests/Feature/Users/ManageUsersTest.php | 2 +- tests/Feature/Users/UserProfileTest.php | 2 +- tests/TestCase.php | 1 + tests/Unit/InvoiceDraftCollectionTest.php | 2 +- tests/Unit/Models/CustomerTest.php | 2 +- tests/Unit/Models/UserTest.php | 2 +- tests/Unit/Policies/CustomerPolicyTest.php | 8 +- tests/Unit/Policies/ProjectPolicyTest.php | 8 +- tests/Unit/Policies/UserPolicyTest.php | 8 +- tests/Unit/Policies/VendorPolicyTest.php | 8 +- tests/Unit/Queries/AdminDashboardQueryTest.php | 16 +-- tests/Unit/References/PaymentTypeTest.php | 6 +- tests/Unit/References/ProjectStatusTest.php | 8 +- tests/Unit/References/SubscriptionTypeTest.php | 6 +- 151 files changed, 699 insertions(+), 662 deletions(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 71c519d..755c284 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -19,7 +19,8 @@ class Kernel extends ConsoleKernel /** * Define the application's command schedule. * - * @param \Illuminate\Console\Scheduling\Schedule $schedule + * @param \Illuminate\Console\Scheduling\Schedule $schedule + * * @return void */ protected function schedule(Schedule $schedule) diff --git a/app/Entities/BaseRepository.php b/app/Entities/BaseRepository.php index 014f416..a76b017 100755 --- a/app/Entities/BaseRepository.php +++ b/app/Entities/BaseRepository.php @@ -9,13 +9,12 @@ use App\Entities\Projects\Project; use App\Entities\Users\User; /** - * Base Repository Class + * Base Repository Class. * * @author Nafies Luthfi */ abstract class BaseRepository extends EloquentRepository { - public function getCustomersList() { return Customer::orderBy('name')->pluck('name', 'id'); @@ -27,6 +26,7 @@ abstract class BaseRepository extends EloquentRepository 'Customer' => Customer::orderBy('name')->pluck('name', 'id')->all(), 'Vendor' => Vendor::orderBy('name')->pluck('name', 'id')->all(), ]; + return $partners; } diff --git a/app/Entities/EloquentRepository.php b/app/Entities/EloquentRepository.php index 2637651..c328ec4 100755 --- a/app/Entities/EloquentRepository.php +++ b/app/Entities/EloquentRepository.php @@ -6,7 +6,7 @@ use App\Exceptions\EntityNotFoundException; use Illuminate\Database\Eloquent\Model; /** - * Eloquent Repository Class + * Eloquent Repository Class. * * @author Nafies Luthfi */ @@ -71,29 +71,30 @@ abstract class EloquentRepository if ($data[$key] == '') { $data[$key] = null; } - } + return $this->storeArray($data); } } - public function update($data = [], $modelId) + public function update($data, $modelId) { foreach ($data as $key => $value) { if (!$data[$key]) { $data[$key] = null; } - } $model = $this->requireById($modelId); $model->update($data); + return $model; } public function delete($modelId) { $model = $this->requireById($modelId); + return $model->delete(); } @@ -110,6 +111,7 @@ abstract class EloquentRepository { $model = $this->getNewInstance($data); $this->storeEloquentModel($model); + return $model; } } diff --git a/app/Entities/Invoices/Invoice.php b/app/Entities/Invoices/Invoice.php index c8f6b8a..b0d917a 100755 --- a/app/Entities/Invoices/Invoice.php +++ b/app/Entities/Invoices/Invoice.php @@ -45,6 +45,7 @@ class Invoice extends Model return ++$lastInvoiceNo; } } + return $prefix.'001'; } diff --git a/app/Entities/Options/Option.php b/app/Entities/Options/Option.php index 3610353..ba5004b 100755 --- a/app/Entities/Options/Option.php +++ b/app/Entities/Options/Option.php @@ -4,9 +4,9 @@ namespace App\Entities\Options; use Illuminate\Database\Eloquent\Model; -class Option extends Model { - - protected $fillable = ['key','value']; +class Option extends Model +{ + protected $fillable = ['key', 'value']; protected $table = 'site_options'; - public $timestamps = false; + public $timestamps = false; } diff --git a/app/Entities/Payments/Payment.php b/app/Entities/Payments/Payment.php index e654abe..daa75f4 100755 --- a/app/Entities/Payments/Payment.php +++ b/app/Entities/Payments/Payment.php @@ -2,7 +2,6 @@ namespace App\Entities\Payments; -use App\Entities\Payments\PaymentPresenter; use App\Entities\Projects\Project; use Illuminate\Database\Eloquent\Model; use Laracasts\Presenter\PresentableTrait; diff --git a/app/Entities/Payments/PaymentPresenter.php b/app/Entities/Payments/PaymentPresenter.php index a97df3b..c086fe4 100644 --- a/app/Entities/Payments/PaymentPresenter.php +++ b/app/Entities/Payments/PaymentPresenter.php @@ -25,4 +25,4 @@ class PaymentPresenter extends Presenter { return paymentTypes($this->entity->type_id); } -} \ No newline at end of file +} diff --git a/app/Entities/Payments/PaymentsRepository.php b/app/Entities/Payments/PaymentsRepository.php index c80653a..0c5889b 100755 --- a/app/Entities/Payments/PaymentsRepository.php +++ b/app/Entities/Payments/PaymentsRepository.php @@ -5,7 +5,7 @@ namespace App\Entities\Payments; use App\Entities\BaseRepository; /** - * Payments Repository Class + * Payments Repository Class. * * @author Nafies Luthfi */ diff --git a/app/Entities/Projects/Job.php b/app/Entities/Projects/Job.php index f0594a7..291b3b8 100755 --- a/app/Entities/Projects/Job.php +++ b/app/Entities/Projects/Job.php @@ -2,15 +2,12 @@ namespace App\Entities\Projects; -use App\Entities\Projects\JobPresenter; -use App\Entities\Projects\Project; use App\Entities\Users\User; use Illuminate\Database\Eloquent\Model; use Laracasts\Presenter\PresentableTrait; class Job extends Model { - use PresentableTrait; protected $presenter = JobPresenter::class; @@ -35,5 +32,4 @@ class Job extends Model { return $this->type_id == 1 ? 'Project' : 'Additional'; } - } diff --git a/app/Entities/Projects/JobPresenter.php b/app/Entities/Projects/JobPresenter.php index 504b3f3..e6b004f 100644 --- a/app/Entities/Projects/JobPresenter.php +++ b/app/Entities/Projects/JobPresenter.php @@ -20,5 +20,4 @@ class JobPresenter extends Presenter { return link_to_route('projects.jobs.index', trans('project.jobs'), [$this->project_id]); } - } diff --git a/app/Entities/Projects/JobsRepository.php b/app/Entities/Projects/JobsRepository.php index 824c77e..5b7078d 100755 --- a/app/Entities/Projects/JobsRepository.php +++ b/app/Entities/Projects/JobsRepository.php @@ -3,7 +3,6 @@ namespace App\Entities\Projects; use App\Entities\BaseRepository; -use App\Entities\Projects\Project; use DB; /** @@ -40,6 +39,7 @@ class JobsRepository extends BaseRepository public function createJob($jobData, $projectId) { $jobData['project_id'] = $projectId; + return $this->storeArray($jobData); } @@ -77,13 +77,12 @@ class JobsRepository extends BaseRepository return Task::findOrFail($taskId); } - public function update($jobData = [], $jobId) + public function update($jobData, $jobId) { foreach ($jobData as $key => $value) { if (!$jobData[$key]) { $jobData[$key] = null; } - } $jobData['price'] = str_replace('.', '', $jobData['price']); diff --git a/app/Entities/Projects/Project.php b/app/Entities/Projects/Project.php index 1bd6d04..ba2f23c 100755 --- a/app/Entities/Projects/Project.php +++ b/app/Entities/Projects/Project.php @@ -5,8 +5,6 @@ namespace App\Entities\Projects; use App\Entities\Invoices\Invoice; use App\Entities\Partners\Customer; use App\Entities\Payments\Payment; -use App\Entities\Projects\ProjectPresenter; -use App\Entities\Projects\Task; use App\Entities\Subscriptions\Subscription; use Illuminate\Database\Eloquent\Model; use Laracasts\Presenter\PresentableTrait; @@ -131,5 +129,4 @@ class Project extends Model ->with('worker', 'tasks') ->get(); } - } diff --git a/app/Entities/Projects/ProjectPresenter.php b/app/Entities/Projects/ProjectPresenter.php index fbd3e9f..ab1d547 100644 --- a/app/Entities/Projects/ProjectPresenter.php +++ b/app/Entities/Projects/ProjectPresenter.php @@ -35,5 +35,4 @@ class ProjectPresenter extends Presenter return $workDuration.' Hari'; } - } diff --git a/app/Entities/Projects/ProjectsRepository.php b/app/Entities/Projects/ProjectsRepository.php index e740c85..3cf9250 100755 --- a/app/Entities/Projects/ProjectsRepository.php +++ b/app/Entities/Projects/ProjectsRepository.php @@ -8,7 +8,7 @@ use DB; use ProjectStatus; /** - * Projects Repository Class + * Projects Repository Class. */ class ProjectsRepository extends BaseRepository { @@ -29,7 +29,6 @@ class ProjectsRepository extends BaseRepository if ($statusId && in_array($statusId, $statusIds)) { $query->where('status_id', $statusId); } - }) ->withCount('payments') ->with('customer') @@ -50,6 +49,7 @@ class ProjectsRepository extends BaseRepository $project = $this->storeArray($projectData); DB::commit(); + return $project; } @@ -60,7 +60,7 @@ class ProjectsRepository extends BaseRepository public function createNewCustomer($customerName, $customerEmail) { - $newCustomer = new Customer; + $newCustomer = new Customer(); $newCustomer->name = $customerName; $newCustomer->email = $customerEmail; $newCustomer->save(); @@ -88,6 +88,7 @@ class ProjectsRepository extends BaseRepository $project->delete(); DB::commit(); + return 'deleted'; } diff --git a/app/Entities/Projects/Status.php b/app/Entities/Projects/Status.php index 4a685e0..6ffb9b2 100644 --- a/app/Entities/Projects/Status.php +++ b/app/Entities/Projects/Status.php @@ -41,7 +41,7 @@ class Status extends ReferenceAbstract public static function getIconById($singleId) { - if (!!static::getById($singleId) && isset(static::$icons[$singleId])) { + if ((bool) static::getById($singleId) && isset(static::$icons[$singleId])) { return static::$icons[$singleId]; } diff --git a/app/Entities/Projects/Task.php b/app/Entities/Projects/Task.php index 88db231..ec9c649 100755 --- a/app/Entities/Projects/Task.php +++ b/app/Entities/Projects/Task.php @@ -2,13 +2,11 @@ namespace App\Entities\Projects; -use App\Entities\Projects\TaskPresenter; use Illuminate\Database\Eloquent\Model; use Laracasts\Presenter\PresentableTrait; class Task extends Model { - use PresentableTrait; protected $presenter = TaskPresenter::class; @@ -18,5 +16,4 @@ class Task extends Model { return $this->belongsTo(Job::class, 'project_id'); } - } diff --git a/app/Entities/Projects/TasksRepository.php b/app/Entities/Projects/TasksRepository.php index 10723f1..fca1547 100755 --- a/app/Entities/Projects/TasksRepository.php +++ b/app/Entities/Projects/TasksRepository.php @@ -5,7 +5,7 @@ namespace App\Entities\Projects; use App\Entities\BaseRepository; /** - * Tasks Repository Class + * Tasks Repository Class. */ class TasksRepository extends BaseRepository { @@ -19,6 +19,7 @@ class TasksRepository extends BaseRepository public function createTask($taskData, $jobId) { $taskData['job_id'] = $jobId; + return $this->storeArray($taskData); } diff --git a/app/Entities/ReferenceAbstract.php b/app/Entities/ReferenceAbstract.php index 61c4fad..ae1689a 100644 --- a/app/Entities/ReferenceAbstract.php +++ b/app/Entities/ReferenceAbstract.php @@ -6,7 +6,7 @@ use App\Exceptions\ReferenceKeyNotFoundException; use Illuminate\Support\Arr; /** - * Base of References class + * Base of References class. * * @author Nafies Luthfi */ @@ -57,7 +57,7 @@ abstract class ReferenceAbstract public static function getColorById($colorId) { - if (!!static::getById($colorId) && isset(static::$colors[$colorId])) { + if ((bool) 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 8ab63a0..a09389a 100755 --- a/app/Entities/Reports/ReportsRepository.php +++ b/app/Entities/Reports/ReportsRepository.php @@ -8,7 +8,7 @@ use App\Entities\Projects\Project; use DB; /** - * Reports Repository Class + * Reports Repository Class. * * @author Nafies Luthfi */ @@ -31,9 +31,9 @@ class ReportsRepository extends BaseRepository public function getMonthlyReports($year, $month) { - $rawQuery = "date, count(`id`) as count"; - $rawQuery .= ", sum(if(in_out = 1, amount, 0)) AS cashin"; - $rawQuery .= ", sum(if(in_out = 0, amount, 0)) AS cashout"; + $rawQuery = 'date, count(`id`) as count'; + $rawQuery .= ', sum(if(in_out = 1, amount, 0)) AS cashin'; + $rawQuery .= ', sum(if(in_out = 0, amount, 0)) AS cashout'; $reportsData = DB::table('payments')->select(DB::raw($rawQuery)) ->where(DB::raw('YEAR(date)'), $year) @@ -54,10 +54,10 @@ class ReportsRepository extends BaseRepository public function getYearlyReports($year) { - $rawQuery = "MONTH(date) as month"; - $rawQuery .= ", count(`id`) as count"; - $rawQuery .= ", sum(if(in_out = 1, amount, 0)) AS cashin"; - $rawQuery .= ", sum(if(in_out = 0, amount, 0)) AS cashout"; + $rawQuery = 'MONTH(date) as month'; + $rawQuery .= ', count(`id`) as count'; + $rawQuery .= ', sum(if(in_out = 1, amount, 0)) AS cashin'; + $rawQuery .= ', sum(if(in_out = 0, amount, 0)) AS cashout'; $reportsData = DB::table('payments')->select(DB::raw($rawQuery)) ->where(DB::raw('YEAR(date)'), $year) @@ -80,9 +80,9 @@ class ReportsRepository extends BaseRepository { // On Progress, Done, On Hold $projects = Project::whereIn('status_id', [2, 3, 6])->with('payments', 'customer')->get(); + return $projects->filter(function ($project) { return $project->cashInTotal() < $project->project_value; })->values(); } - } diff --git a/app/Entities/Subscriptions/SubscriptionPresenter.php b/app/Entities/Subscriptions/SubscriptionPresenter.php index 1f0e182..750ef4e 100644 --- a/app/Entities/Subscriptions/SubscriptionPresenter.php +++ b/app/Entities/Subscriptions/SubscriptionPresenter.php @@ -8,6 +8,6 @@ class SubscriptionPresenter extends Presenter { public function customerNameAndEmail() { - return $this->customer_id ? $this->customer->name . ' (' . $this->customer->email . ')' : '-'; + return $this->customer_id ? $this->customer->name.' ('.$this->customer->email.')' : '-'; } -} \ No newline at end of file +} diff --git a/app/Entities/Subscriptions/SubscriptionsRepository.php b/app/Entities/Subscriptions/SubscriptionsRepository.php index e8c802d..4556018 100755 --- a/app/Entities/Subscriptions/SubscriptionsRepository.php +++ b/app/Entities/Subscriptions/SubscriptionsRepository.php @@ -5,7 +5,7 @@ namespace App\Entities\Subscriptions; use App\Entities\BaseRepository; /** - * Subscriptions Repository Class + * Subscriptions Repository Class. */ class SubscriptionsRepository extends BaseRepository { @@ -28,7 +28,6 @@ class SubscriptionsRepository extends BaseRepository if ($q) { $query->where('name', 'like', '%'.$q.'%'); } - }) ->with('customer', 'vendor') ->paginate($this->_paginate); diff --git a/app/Entities/Users/Event.php b/app/Entities/Users/Event.php index 0fd8cb3..0e1c1cc 100644 --- a/app/Entities/Users/Event.php +++ b/app/Entities/Users/Event.php @@ -3,7 +3,6 @@ namespace App\Entities\Users; use App\Entities\Projects\Project; -use App\Entities\Users\User; use Illuminate\Database\Eloquent\Model; /** @@ -11,9 +10,9 @@ use Illuminate\Database\Eloquent\Model; */ class Event extends Model { - protected $table = 'user_events'; + protected $table = 'user_events'; protected $guarded = ['id', 'created_at', 'updated_at']; - protected $casts = ['is_allday' => 'boolean']; + protected $casts = ['is_allday' => 'boolean']; public function user() { diff --git a/app/Entities/Users/Role.php b/app/Entities/Users/Role.php index 43698fe..1f3378f 100644 --- a/app/Entities/Users/Role.php +++ b/app/Entities/Users/Role.php @@ -5,7 +5,7 @@ namespace App\Entities\Users; use App\Entities\ReferenceAbstract; /** - * Role Class + * Role Class. */ class Role extends ReferenceAbstract { diff --git a/app/Entities/Users/User.php b/app/Entities/Users/User.php index 644ed80..23549be 100644 --- a/app/Entities/Users/User.php +++ b/app/Entities/Users/User.php @@ -35,7 +35,8 @@ class User extends Authenticatable /** * Assign the given role to the user. * - * @param string $role + * @param string $role + * * @return void */ public function assignRole(string $roleName) @@ -51,7 +52,8 @@ class User extends Authenticatable /** * Remove the given role from the user. * - * @param string $role + * @param string $role + * * @return void */ public function removeRole(string $roleName) @@ -67,8 +69,9 @@ class User extends Authenticatable /** * Determine if the user has the given role. * - * @param string $role - * @return boolean + * @param string $role + * + * @return bool */ public function hasRole(string $roleName) { @@ -80,8 +83,9 @@ class User extends Authenticatable /** * Determine if the user has the given array of role. * - * @param array $role - * @return boolean + * @param array $role + * + * @return bool */ public function hasRoles(array $roleNameArray) { diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index fcb8eb6..322690b 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -28,7 +28,8 @@ class Handler extends ExceptionHandler * * This is a great spot to send exceptions to Sentry, Bugsnag, etc. * - * @param \Exception $exception + * @param \Exception $exception + * * @return void */ public function report(Exception $exception) @@ -39,8 +40,9 @@ class Handler extends ExceptionHandler /** * Render an exception into an HTTP response. * - * @param \Illuminate\Http\Request $request - * @param \Exception $exception + * @param \Illuminate\Http\Request $request + * @param \Exception $exception + * * @return \Illuminate\Http\Response */ public function render($request, Exception $exception) @@ -48,22 +50,22 @@ class Handler extends ExceptionHandler // throw $exception; if ($exception instanceof AuthorizationException) { - if ($request->expectsJson()) { return response()->json(['error' => 'Forbidden Action.'], 403); } flash()->error('Invalid access'); + return redirect()->home(); } if ($exception instanceof EntityNotFoundException) { - if ($request->expectsJson()) { return response()->json(['error' => 'Data not found.'], 404); } flash()->error('Data not found.'); + return redirect()->home(); } @@ -73,8 +75,9 @@ class Handler extends ExceptionHandler /** * Convert an authentication exception into an unauthenticated response. * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Auth\AuthenticationException $exception + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Auth\AuthenticationException $exception + * * @return \Illuminate\Http\Response */ protected function unauthenticated($request, AuthenticationException $exception) diff --git a/app/Exceptions/ReferenceKeyNotFoundException.php b/app/Exceptions/ReferenceKeyNotFoundException.php index 3ec979d..1330884 100644 --- a/app/Exceptions/ReferenceKeyNotFoundException.php +++ b/app/Exceptions/ReferenceKeyNotFoundException.php @@ -3,9 +3,10 @@ namespace App\Exceptions; /** - * Reference Key Not Found Exception + * Reference Key Not Found Exception. * * @author Nafies Luthfi */ class ReferenceKeyNotFoundException extends \RuntimeException -{} +{ +} diff --git a/app/Http/Controllers/Api/EventsController.php b/app/Http/Controllers/Api/EventsController.php index 8a4bcf4..8b2cefb 100644 --- a/app/Http/Controllers/Api/EventsController.php +++ b/app/Http/Controllers/Api/EventsController.php @@ -12,27 +12,29 @@ class EventsController extends Controller { $start = $request->get('start'); $end = $request->get('end'); - $events = Event::where(function($query) use ($start, $end) { - if ($start && $end) + $events = Event::where(function ($query) use ($start, $end) { + if ($start && $end) { $query->whereBetween('start', [$start, $end]); + } })->with('user')->get(); $response = fractal() ->collection($events) - ->transformWith(function($event) { + ->transformWith(function ($event) { $isOwnEvent = $event->user_id == auth()->id(); + return [ - 'id' => $event->id, - 'user' => $event->user->name, - 'user_id' => $event->user_id, + 'id' => $event->id, + 'user' => $event->user->name, + 'user_id' => $event->user_id, 'project_id' => $event->project_id, - 'title' => $event->title, - 'body' => $event->body, - 'start' => $event->start, - 'end' => $event->end, - 'allDay' => $event->is_allday, - 'editable' => true, - 'color' => $isOwnEvent ? '' : '#B7B7B7', + 'title' => $event->title, + 'body' => $event->body, + 'start' => $event->start, + 'end' => $event->end, + 'allDay' => $event->is_allday, + 'editable' => true, + 'color' => $isOwnEvent ? '' : '#B7B7B7', ]; }) ->toArray(); @@ -44,37 +46,37 @@ class EventsController extends Controller { $this->validate($request, [ 'project_id' => 'nullable|numeric|exists:projects,id', - 'title' => 'required|string|max:60', - 'body' => 'nullable|string|max:255', - 'start' => 'required|date|date_format:Y-m-d H:i:s', - 'end' => 'date|date_format:Y-m-d H:i:s', - 'is_allday' => '', + 'title' => 'required|string|max:60', + 'body' => 'nullable|string|max:255', + 'start' => 'required|date|date_format:Y-m-d H:i:s', + 'end' => 'date|date_format:Y-m-d H:i:s', + 'is_allday' => '', ]); - $event = new Event; + $event = new Event(); $event->user_id = auth()->id(); $event->project_id = $request->get('project_id'); $event->title = $request->get('title'); $event->body = $request->get('body'); $event->start = $request->get('start'); - $event->end = $request->get('is_allday') == "true" ? null : $request->get('end'); - $event->is_allday = $request->get('is_allday') == "true" ? 1 : 0; + $event->end = $request->get('is_allday') == 'true' ? null : $request->get('end'); + $event->is_allday = $request->get('is_allday') == 'true' ? 1 : 0; $event->save(); $response = [ - 'message' => trans('event.created') + 'message' => trans('event.created'), ] + fractal()->item($event) - ->transformWith(function($event) { + ->transformWith(function ($event) { return [ - 'id' => $event->id, + 'id' => $event->id, 'project_id' => $event->project_id, - 'user' => $event->user->name, - 'title' => $event->title, - 'body' => $event->body, - 'start' => $event->start, - 'end' => $event->end, - 'allDay' => $event->is_allday, + 'user' => $event->user->name, + 'title' => $event->title, + 'body' => $event->body, + 'start' => $event->start, + 'end' => $event->end, + 'allDay' => $event->is_allday, ]; }) ->toArray(); @@ -90,11 +92,11 @@ class EventsController extends Controller public function update(Request $request) { $this->validate($request, [ - 'id' => 'required|numeric|exists:user_events,id', + 'id' => 'required|numeric|exists:user_events,id', 'project_id' => 'nullable|numeric|exists:projects,id', - 'title' => 'required|string|max:60', - 'body' => 'nullable|string|max:255', - 'is_allday' => '', + 'title' => 'required|string|max:60', + 'body' => 'nullable|string|max:255', + 'is_allday' => '', ]); $event = Event::findOrFail($request->get('id')); @@ -108,18 +110,18 @@ class EventsController extends Controller $event->save(); $response = [ - 'message' => trans('event.updated') + 'message' => trans('event.updated'), ] + fractal()->item($event) - ->transformWith(function($event) { + ->transformWith(function ($event) { return [ - 'id' => $event->id, + 'id' => $event->id, 'project_id' => $event->project_id, - 'user' => $event->user->name, - 'title' => $event->title, - 'body' => $event->body, - 'start' => $event->start, - 'end' => $event->end, - 'allDay' => $event->is_allday, + 'user' => $event->user->name, + 'title' => $event->title, + 'body' => $event->body, + 'start' => $event->start, + 'end' => $event->end, + 'allDay' => $event->is_allday, ]; }) ->toArray(); @@ -130,7 +132,7 @@ class EventsController extends Controller public function destroy(Request $request) { $this->validate($request, [ - 'id' => 'required|numeric|exists:user_events,id' + 'id' => 'required|numeric|exists:user_events,id', ]); $event = Event::findOrFail($request->get('id')); @@ -143,9 +145,9 @@ class EventsController extends Controller public function reschedule(Request $request) { $this->validate($request, [ - 'id' => 'required|numeric|exists:user_events,id', + 'id' => 'required|numeric|exists:user_events,id', 'start' => 'required|date|date_format:Y-m-d H:i:s', - 'end' => 'date|date_format:Y-m-d H:i:s', + 'end' => 'date|date_format:Y-m-d H:i:s', ]); $event = Event::findOrFail($request->get('id')); @@ -160,16 +162,16 @@ class EventsController extends Controller $event->save(); $response = [ - 'message' => trans('event.rescheduled') + 'message' => trans('event.rescheduled'), ] + fractal()->item($event) - ->transformWith(function($event) { + ->transformWith(function ($event) { return [ - 'id' => $event->id, - 'user' => $event->user->name, - 'title' => $event->title, - 'body' => $event->body, - 'start' => $event->start, - 'end' => $event->end, + 'id' => $event->id, + 'user' => $event->user->name, + 'title' => $event->title, + 'body' => $event->body, + 'start' => $event->start, + 'end' => $event->end, 'allDay' => $event->is_allday, ]; }) diff --git a/app/Http/Controllers/Api/ProjectsController.php b/app/Http/Controllers/Api/ProjectsController.php index 9e20a07..95313a8 100644 --- a/app/Http/Controllers/Api/ProjectsController.php +++ b/app/Http/Controllers/Api/ProjectsController.php @@ -7,7 +7,7 @@ use App\Http\Controllers\Controller; use Illuminate\Http\Request; /** - * Projects Controller + * Projects Controller. * * @author Nafies Luthfi */ @@ -19,6 +19,7 @@ class ProjectsController extends Controller { $this->repo = $repo; } + public function index(Request $request) { return $this->repo->getProjects($request->get('q'), $request->get('status_id')); @@ -39,6 +40,7 @@ class ProjectsController extends Controller return $project; }) ->toArray(); + return $response; } } diff --git a/app/Http/Controllers/Auth/ChangePasswordController.php b/app/Http/Controllers/Auth/ChangePasswordController.php index 5a85ea9..6b1295a 100644 --- a/app/Http/Controllers/Auth/ChangePasswordController.php +++ b/app/Http/Controllers/Auth/ChangePasswordController.php @@ -25,8 +25,8 @@ class ChangePasswordController extends Controller public function update(Request $request) { $input = $request->validate([ - 'old_password' => 'required', - 'password' => 'required|between:6,15|confirmed', + 'old_password' => 'required', + 'password' => 'required|between:6,15|confirmed', 'password_confirmation' => 'required', ]); @@ -36,10 +36,12 @@ class ChangePasswordController extends Controller $user->save(); flash(trans('auth.password_changed'), 'success'); + return back(); } flash(trans('auth.old_password_failed'), 'danger'); + return back(); } } diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index fce06e0..b39fc16 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -41,7 +41,8 @@ class LoginController extends Controller /** * Send the response after the user was authenticated. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ protected function sendLoginResponse(Request $request) @@ -59,7 +60,8 @@ class LoginController extends Controller /** * Log the user out of the application. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function logout(Request $request) diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 6f41d25..c56b089 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -33,14 +33,15 @@ class ResetPasswordController extends Controller /** * Reset the given user's password. * - * @param \Illuminate\Contracts\Auth\CanResetPassword $user - * @param string $password + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @param string $password + * * @return void */ protected function resetPassword($user, $password) { $user->forceFill([ - 'password' => $password, + 'password' => $password, 'remember_token' => str_random(60), ])->save(); diff --git a/app/Http/Controllers/BackupsController.php b/app/Http/Controllers/BackupsController.php index 4abaa8e..71376de 100755 --- a/app/Http/Controllers/BackupsController.php +++ b/app/Http/Controllers/BackupsController.php @@ -62,6 +62,7 @@ class BackupsController extends Controller } flash(trans('backup.deleted', ['filename' => $fileName]), 'warning'); + return redirect()->route('backups.index'); } @@ -79,6 +80,7 @@ class BackupsController extends Controller } flash(trans('backup.restored', ['filename' => $fileName]), 'success'); + return redirect()->route('backups.index'); } @@ -98,6 +100,7 @@ class BackupsController extends Controller } flash(trans('backup.uploaded', ['filename' => $fileName]), 'success'); + return redirect()->route('backups.index'); } } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 03e02a2..a0a2a8a 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,10 +2,10 @@ namespace App\Http\Controllers; +use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Bus\DispatchesJobs; -use Illuminate\Routing\Controller as BaseController; use Illuminate\Foundation\Validation\ValidatesRequests; -use Illuminate\Foundation\Auth\Access\AuthorizesRequests; +use Illuminate\Routing\Controller as BaseController; class Controller extends BaseController { diff --git a/app/Http/Controllers/InstallationController.php b/app/Http/Controllers/InstallationController.php index dd870c3..9cbb40e 100755 --- a/app/Http/Controllers/InstallationController.php +++ b/app/Http/Controllers/InstallationController.php @@ -8,7 +8,7 @@ use Auth; use DB; /** - * Installation Controller + * Installation Controller. * * @author Nafies Luthfi */ @@ -24,6 +24,7 @@ class InstallationController extends Controller if (User::count()) { return redirect()->route('auth.login'); } + return view('auth.app-install'); } @@ -31,7 +32,6 @@ class InstallationController extends Controller { $agencyData = collect($request->only('agency_name', 'agency_website', 'email')) ->map(function ($value, $key) { - if ($key == 'email') { $key = 'agency_email'; } @@ -57,6 +57,7 @@ class InstallationController extends Controller DB::commit(); flash()->success(trans('auth.welcome', ['name' => $admin->name])); + return redirect()->route('home'); } } diff --git a/app/Http/Controllers/Invoices/DraftsController.php b/app/Http/Controllers/Invoices/DraftsController.php index 7d54393..65323f0 100644 --- a/app/Http/Controllers/Invoices/DraftsController.php +++ b/app/Http/Controllers/Invoices/DraftsController.php @@ -41,6 +41,7 @@ class DraftsController extends Controller } $projects = Project::pluck('name', 'id'); + return view('invoice-drafts.index', compact('draft', 'projects')); } diff --git a/app/Http/Controllers/Invoices/InvoicesController.php b/app/Http/Controllers/Invoices/InvoicesController.php index 63f7252..50f3c19 100644 --- a/app/Http/Controllers/Invoices/InvoicesController.php +++ b/app/Http/Controllers/Invoices/InvoicesController.php @@ -56,6 +56,7 @@ class InvoicesController extends Controller if (request('invoice_id') == $invoice->id && $invoice->delete()) { flash(trans('invoice.deleted'), 'warning'); + return redirect()->route('projects.invoices', $invoice->project_id); } diff --git a/app/Http/Controllers/JobsController.php b/app/Http/Controllers/JobsController.php index c7cc205..54c15d4 100755 --- a/app/Http/Controllers/JobsController.php +++ b/app/Http/Controllers/JobsController.php @@ -86,9 +86,8 @@ class JobsController extends Controller { if ($req->ajax()) { $data = $this->repo->tasksReorder($req->get('postData')); + return 'oke'; } - - return null; } } diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index b2cada3..69c0609 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -15,5 +15,4 @@ class PagesController extends Controller { return view('pages.about'); } - } diff --git a/app/Http/Controllers/Partners/CustomersController.php b/app/Http/Controllers/Partners/CustomersController.php index 7462aee..e9c332e 100644 --- a/app/Http/Controllers/Partners/CustomersController.php +++ b/app/Http/Controllers/Partners/CustomersController.php @@ -37,7 +37,8 @@ class CustomersController extends Controller /** * Store a newly created customer in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Request $request) @@ -62,7 +63,8 @@ class CustomersController extends Controller /** * Show the specified customer. * - * @param \App\Entities\Partners\Customer $customer + * @param \App\Entities\Partners\Customer $customer + * * @return \Illuminate\Http\Response */ public function show(Customer $customer) @@ -73,7 +75,8 @@ class CustomersController extends Controller /** * Show the edit customer form. * - * @param \App\Entities\Partners\Customer $customer + * @param \App\Entities\Partners\Customer $customer + * * @return \Illuminate\Http\Response */ public function edit(Customer $customer) @@ -84,8 +87,9 @@ class CustomersController extends Controller /** * Update the specified customer in storage. * - * @param \Illuminate\Http\Request $request - * @param \App\Entities\Partners\Customer $customer + * @param \Illuminate\Http\Request $request + * @param \App\Entities\Partners\Customer $customer + * * @return \Illuminate\Http\Response */ public function update(Request $request, Customer $customer) @@ -111,7 +115,8 @@ class CustomersController extends Controller /** * Remove the specified customer from storage. * - * @param \App\Entities\Partners\Customer $customer + * @param \App\Entities\Partners\Customer $customer + * * @return \Illuminate\Http\Response */ public function destroy(Customer $customer) @@ -125,10 +130,12 @@ class CustomersController extends Controller if (request('customer_id') == $customer->id && $customer->delete()) { flash(trans('customer.deleted'), 'warning'); + return redirect()->route('customers.index', $routeParam); } flash(trans('customer.undeleted'), 'danger'); + return back(); } } diff --git a/app/Http/Controllers/Partners/VendorsController.php b/app/Http/Controllers/Partners/VendorsController.php index b9fe53b..9c03d43 100644 --- a/app/Http/Controllers/Partners/VendorsController.php +++ b/app/Http/Controllers/Partners/VendorsController.php @@ -16,7 +16,7 @@ class VendorsController extends Controller public function index() { $editableVendor = null; - $vendors = Vendor::where(function ($query) { + $vendors = Vendor::where(function ($query) { $query->where('name', 'like', '%'.request('q').'%'); })->paginate(25); @@ -30,7 +30,8 @@ class VendorsController extends Controller /** * Store a newly created vendor in storage. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function store(Request $request) @@ -44,14 +45,16 @@ class VendorsController extends Controller Vendor::create($newVendorData); flash(trans('vendor.created'), 'success'); + return redirect()->route('vendors.index'); } /** * Update the specified vendor in storage. * - * @param \Illuminate\Http\Request $request - * @param \App\Entities\Partners\Vendor $vendor + * @param \Illuminate\Http\Request $request + * @param \App\Entities\Partners\Vendor $vendor + * * @return \Illuminate\Http\Response */ public function update(Request $request, Vendor $vendor) @@ -68,13 +71,15 @@ class VendorsController extends Controller $vendor = $vendor->update($vendorData); flash(trans('vendor.updated'), 'success'); + return redirect()->route('vendors.index', $routeParam); } /** * Remove the specified vendor from storage. * - * @param \App\Entities\Partners\Vendor $vendor + * @param \App\Entities\Partners\Vendor $vendor + * * @return \Illuminate\Http\Response */ public function destroy(Vendor $vendor) @@ -87,10 +92,12 @@ class VendorsController extends Controller if (request('vendor_id') == $vendor->id && $vendor->delete()) { flash(trans('vendor.deleted'), 'warning'); + return redirect()->route('vendors.index', $routeParam); } flash(trans('vendor.undeleted'), 'danger'); + return back(); } } diff --git a/app/Http/Controllers/PaymentsController.php b/app/Http/Controllers/PaymentsController.php index 09fe1d5..765b8a7 100755 --- a/app/Http/Controllers/PaymentsController.php +++ b/app/Http/Controllers/PaymentsController.php @@ -11,7 +11,7 @@ use App\Http\Requests\Payments\UpdateRequest; use Illuminate\Http\Request; /** - * Payments Controller class + * Payments Controller class. * * @author Nafies Luthfi */ @@ -28,6 +28,7 @@ class PaymentsController extends Controller { $payments = $this->repo->getPayments($request->only('q', 'partner_id')); $partnersList = Customer::pluck('name', 'id')->all(); + return view('payments.index', compact('payments', 'partnersList')); } @@ -35,6 +36,7 @@ class PaymentsController extends Controller { $projects = $this->repo->getProjectsList(); $partners = $this->repo->getCustomersAndVendorsList(); + return view('payments.create', compact('projects', 'partners')); } @@ -42,6 +44,7 @@ class PaymentsController extends Controller { $payment = $this->repo->create($request->except('_token')); flash()->success(trans('payment.created')); + return redirect()->route('projects.payments', $payment->project_id); } @@ -54,6 +57,7 @@ class PaymentsController extends Controller { $projects = $this->repo->getProjectsList(); $partners = $this->repo->getCustomersAndVendorsList(); + return view('payments.edit', compact('payment', 'projects', 'partners')); } @@ -62,6 +66,7 @@ class PaymentsController extends Controller $payment->update($request->except(['_method', '_token'])); flash()->success(trans('payment.updated')); + return redirect()->route('payments.show', $payment->id); } diff --git a/app/Http/Controllers/Projects/FeesController.php b/app/Http/Controllers/Projects/FeesController.php index 7add015..2f26ca4 100644 --- a/app/Http/Controllers/Projects/FeesController.php +++ b/app/Http/Controllers/Projects/FeesController.php @@ -8,7 +8,7 @@ use App\Entities\Users\User; use App\Http\Controllers\Controller; /** - * Project Fees Controller + * Project Fees Controller. * * @author Nafies Luthfi */ @@ -17,6 +17,7 @@ class FeesController extends Controller public function create(Project $project) { $partners = User::pluck('name', 'id')->all(); + return view('projects.fees.create', compact('project', 'partners')); } @@ -36,6 +37,7 @@ class FeesController extends Controller Payment::create($newPaymentData); flash()->success(trans('payment.created')); + return redirect()->route('projects.payments', $project->id); } } diff --git a/app/Http/Controllers/Projects/FilesController.php b/app/Http/Controllers/Projects/FilesController.php index ba4f6e0..684b007 100644 --- a/app/Http/Controllers/Projects/FilesController.php +++ b/app/Http/Controllers/Projects/FilesController.php @@ -53,7 +53,6 @@ class FilesController extends Controller } else { flash()->error('Upload file gagal, coba kembali.'); } - } else { flash()->error('Upload file gagal, coba kembali.'); } @@ -67,6 +66,7 @@ class FilesController extends Controller if ($file && file_exists(storage_path('app/public/files/'.$file->filename))) { $extension = FileSystem::extension('public/files/'.$file->filename); + return response()->download(storage_path('app/public/files/'.$file->filename), $file->title.'.'.$extension); } diff --git a/app/Http/Controllers/Projects/JobsController.php b/app/Http/Controllers/Projects/JobsController.php index 14f8e6b..7aece9d 100755 --- a/app/Http/Controllers/Projects/JobsController.php +++ b/app/Http/Controllers/Projects/JobsController.php @@ -47,6 +47,7 @@ class JobsController extends Controller if ($req->has('project_id')) { $selectedProject = $this->repo->requireProjectById($req->get('project_id')); } + return view('jobs.add-from-other-project', compact('project', 'workers', 'projects', 'selectedProject')); } diff --git a/app/Http/Controllers/Projects/ProjectsController.php b/app/Http/Controllers/Projects/ProjectsController.php index 805628a..5db7f81 100755 --- a/app/Http/Controllers/Projects/ProjectsController.php +++ b/app/Http/Controllers/Projects/ProjectsController.php @@ -10,7 +10,7 @@ use App\Http\Requests\Projects\UpdateRequest; use Illuminate\Http\Request; /** - * Projects Controller + * Projects Controller. * * @author Nafies Luthfi */ @@ -32,12 +32,14 @@ class ProjectsController extends Controller } $projects = $this->repo->getProjects($request->get('q'), $statusId); + return view('projects.index', compact('projects', 'status')); } public function create() { $customers = $this->repo->getCustomersList(); + return view('projects.create', compact('customers')); } @@ -45,12 +47,14 @@ class ProjectsController extends Controller { $project = $this->repo->create($request->except('_token')); flash()->success(trans('project.created')); + return redirect()->route('projects.show', $project->id); } public function show($projectId) { $project = $this->repo->requireById($projectId); + return view('projects.show', compact('project')); } @@ -58,6 +62,7 @@ class ProjectsController extends Controller { $project = $this->repo->requireById($projectId); $customers = $this->repo->getCustomersList(); + return view('projects.edit', compact('project', 'customers')); } @@ -65,12 +70,14 @@ class ProjectsController extends Controller { $project = $this->repo->update($request->except(['_method', '_token']), $projectId); flash()->success(trans('project.updated')); + return redirect()->route('projects.edit', $projectId); } public function delete($projectId) { $project = $this->repo->requireById($projectId); + return view('projects.delete', compact('project')); } @@ -89,6 +96,7 @@ class ProjectsController extends Controller public function subscriptions($projectId) { $project = $this->repo->requireById($projectId); + return view('projects.subscriptions', compact('project')); } @@ -96,6 +104,7 @@ class ProjectsController extends Controller { $project = $this->repo->requireById($projectId); $project->load('payments.partner'); + return view('projects.payments', compact('project')); } @@ -103,6 +112,7 @@ class ProjectsController extends Controller { $project = $this->repo->updateStatus($request->get('status_id'), $projectId); flash()->success(trans('project.updated')); + return redirect()->route('projects.show', $projectId); } @@ -110,9 +120,8 @@ class ProjectsController extends Controller { if ($request->ajax()) { $data = $this->repo->jobsReorder($request->get('postData')); + return 'oke'; } - - return null; } } diff --git a/app/Http/Controllers/Projects/TasksController.php b/app/Http/Controllers/Projects/TasksController.php index dafcaea..a35b1c5 100755 --- a/app/Http/Controllers/Projects/TasksController.php +++ b/app/Http/Controllers/Projects/TasksController.php @@ -15,7 +15,6 @@ use App\Http\Requests\Tasks\UpdateRequest; */ class TasksController extends Controller { - private $repo; public function __construct(TasksRepository $repo) @@ -27,6 +26,7 @@ class TasksController extends Controller { $job = $this->repo->createTask($req->except('_token'), $jobId); flash()->success(trans('task.created')); + return redirect()->route('jobs.show', $jobId); } @@ -34,6 +34,7 @@ class TasksController extends Controller { $task = $this->repo->update($req->except(['_method', '_token']), $taskId); flash()->success(trans('task.updated')); + return redirect()->route('jobs.show', $task->job_id); } @@ -51,5 +52,4 @@ class TasksController extends Controller return redirect()->route('jobs.show', $jobId); } - } diff --git a/app/Http/Controllers/References/OptionsController.php b/app/Http/Controllers/References/OptionsController.php index d25dee5..c23c6d5 100755 --- a/app/Http/Controllers/References/OptionsController.php +++ b/app/Http/Controllers/References/OptionsController.php @@ -23,13 +23,14 @@ class OptionsController extends Controller public function store(Request $req) { $newOptionData = $req->validate([ - 'key' => 'required|max:255|alpha_dash', + 'key' => 'required|max:255|alpha_dash', 'value' => 'max:255', ]); $option = Option::create($newOptionData); flash()->success(trans('option.created')); + return redirect()->route('options.index'); } @@ -55,7 +56,7 @@ class OptionsController extends Controller } flash()->success(trans('option.updated')); + return redirect()->route('options.index'); } - } diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index e304c1b..33798bc 100755 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -3,7 +3,6 @@ namespace App\Http\Controllers; use App\Entities\Reports\ReportsRepository; -use App\Http\Controllers\Controller; use Illuminate\Http\Request; /** @@ -23,6 +22,7 @@ class ReportsController extends Controller public function index(Request $req) { $reports = $this->repo->getAll($req->get('q')); + return view('reports.payments.index', compact('reports')); } @@ -32,6 +32,7 @@ class ReportsController extends Controller $date = $req->get('date', date('Y-m-d')); $payments = $this->repo->getDailyReports($date, $q); + return view('reports.payments.daily', compact('payments', 'date')); } @@ -46,6 +47,7 @@ class ReportsController extends Controller $reports = $this->repo->getMonthlyReports($year, $month); $months = \getMonths(); $years = \getYears(); + return view('reports.payments.monthly', compact('reports', 'months', 'years', 'month', 'year')); } @@ -55,13 +57,14 @@ class ReportsController extends Controller $reports = $this->repo->getYearlyReports($year); $years = \getYears(); + return view('reports.payments.yearly', compact('reports', 'years', 'year')); } public function currentCredits() { $projects = $this->repo->getCurrentCredits(); + return view('reports.current-credits', compact('projects')); } - } diff --git a/app/Http/Controllers/SubscriptionsController.php b/app/Http/Controllers/SubscriptionsController.php index 62c75f4..8b6974b 100755 --- a/app/Http/Controllers/SubscriptionsController.php +++ b/app/Http/Controllers/SubscriptionsController.php @@ -5,7 +5,6 @@ namespace App\Http\Controllers; use App\Entities\Subscriptions\Subscription; use App\Entities\Subscriptions\SubscriptionsRepository; use App\Entities\Subscriptions\Type; -use App\Http\Controllers\Controller; use App\Http\Requests\SubscriptionRequest as FormRequest; use Illuminate\Http\Request; @@ -43,9 +42,10 @@ class SubscriptionsController extends Controller public function store(FormRequest $subscriptionCreateRequest) { - $subscriptionCreateRequest->approveFor(new Subscription); + $subscriptionCreateRequest->approveFor(new Subscription()); flash()->success(trans('subscription.created')); + return redirect()->route('subscriptions.index'); } @@ -71,6 +71,7 @@ class SubscriptionsController extends Controller $subscriptionUpdateRequest->approveFor($subscription); flash()->success(trans('subscription.updated')); + return redirect()->route('subscriptions.edit', $subscription->id); } @@ -79,6 +80,7 @@ class SubscriptionsController extends Controller $subscriptionDeleteRequest->approveToDelete($subscription); flash()->success(trans('subscription.deleted')); + return redirect()->route('subscriptions.index'); } @@ -91,5 +93,4 @@ class SubscriptionsController extends Controller { return trans('subscription.'.$pageType).' - '.$subscription->name.' - '.$subscription->customer->name; } - } diff --git a/app/Http/Controllers/Users/AgencyController.php b/app/Http/Controllers/Users/AgencyController.php index 5980583..7f19d2f 100644 --- a/app/Http/Controllers/Users/AgencyController.php +++ b/app/Http/Controllers/Users/AgencyController.php @@ -6,7 +6,7 @@ use App\Http\Controllers\Controller; use Option; /** - * Agency Profile Controller + * Agency Profile Controller. * * @author Nafies Luthfi */ @@ -64,6 +64,7 @@ class AgencyController extends Controller Option::set('agency_logo_path', $filename); flash(trans('agency.updated'), 'success'); + return redirect()->route('users.agency.show'); } } diff --git a/app/Http/Controllers/Users/ProfileController.php b/app/Http/Controllers/Users/ProfileController.php index 1a24870..1f03ae9 100644 --- a/app/Http/Controllers/Users/ProfileController.php +++ b/app/Http/Controllers/Users/ProfileController.php @@ -5,7 +5,7 @@ namespace App\Http\Controllers\Users; use App\Http\Controllers\Controller; /** - * User Profile Controller + * User Profile Controller. * * @author Nafies Luthfi */ @@ -14,6 +14,7 @@ class ProfileController extends Controller public function show() { $user = auth()->user(); + return view('users.profile.show', compact('user')); } diff --git a/app/Http/Controllers/Users/UsersController.php b/app/Http/Controllers/Users/UsersController.php index 7332345..3aa627e 100755 --- a/app/Http/Controllers/Users/UsersController.php +++ b/app/Http/Controllers/Users/UsersController.php @@ -96,6 +96,7 @@ class UsersController extends Controller \DB::table('user_roles')->insert($rolesData); flash()->success(trans('user.updated')); + return redirect()->route('users.edit', $user->id); } @@ -123,5 +124,4 @@ class UsersController extends Controller return redirect()->route('users.index'); } - } diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 67abcae..84754b1 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -10,9 +10,10 @@ class Authenticate /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard + * * @return mixed */ public function handle($request, Closure $next, $guard = null) diff --git a/app/Http/Middleware/GlobalViewVariables.php b/app/Http/Middleware/GlobalViewVariables.php index ab188c7..8a99179 100644 --- a/app/Http/Middleware/GlobalViewVariables.php +++ b/app/Http/Middleware/GlobalViewVariables.php @@ -16,8 +16,9 @@ class GlobalViewVariables /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * * @return mixed */ public function handle($request, Closure $next) diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index e27860e..abb8423 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -10,9 +10,10 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @param string|null $guard + * * @return mixed */ public function handle($request, Closure $next, $guard = null) diff --git a/app/Http/Middleware/Role.php b/app/Http/Middleware/Role.php index 4b2de90..b05b85c 100644 --- a/app/Http/Middleware/Role.php +++ b/app/Http/Middleware/Role.php @@ -14,8 +14,9 @@ class Role /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * * @return mixed */ public function handle($request, Closure $next, $names) @@ -29,6 +30,7 @@ class Role // Cek apakah grup user ada di dalam array $nameArray? if (auth()->user()->hasRoles($nameArray) == false) { flash()->error('Anda tidak dapat mengakses halaman '.$request->path().'.'); + return redirect()->route('home'); } diff --git a/app/Http/Requests/Jobs/CreateRequest.php b/app/Http/Requests/Jobs/CreateRequest.php index 0e7724f..7537c51 100644 --- a/app/Http/Requests/Jobs/CreateRequest.php +++ b/app/Http/Requests/Jobs/CreateRequest.php @@ -15,6 +15,7 @@ class CreateRequest extends Request public function authorize() { $project = Project::findOrFail($this->segment(2)); + return auth()->user()->can('manage_jobs', $project); } @@ -33,5 +34,4 @@ class CreateRequest extends Request 'description' => 'max:255', ]; } - } diff --git a/app/Http/Requests/Jobs/DeleteRequest.php b/app/Http/Requests/Jobs/DeleteRequest.php index dd01ec3..899256e 100644 --- a/app/Http/Requests/Jobs/DeleteRequest.php +++ b/app/Http/Requests/Jobs/DeleteRequest.php @@ -7,7 +7,6 @@ use App\Http\Requests\Request; class DeleteRequest extends Request { - /** * Determine if the user is authorized to make this request. * @@ -16,6 +15,7 @@ class DeleteRequest extends Request public function authorize() { $project = Project::findOrFail($this->get('project_id')); + return auth()->user()->can('manage_jobs', $project); } @@ -31,5 +31,4 @@ class DeleteRequest extends Request 'project_id' => 'required', ]; } - } diff --git a/app/Http/Requests/Jobs/UpdateRequest.php b/app/Http/Requests/Jobs/UpdateRequest.php index 8b7c6c4..ec9395f 100644 --- a/app/Http/Requests/Jobs/UpdateRequest.php +++ b/app/Http/Requests/Jobs/UpdateRequest.php @@ -7,7 +7,6 @@ use App\Http\Requests\Request; class UpdateRequest extends Request { - /** * Determine if the user is authorized to make this request. * @@ -16,6 +15,7 @@ class UpdateRequest extends Request public function authorize() { $project = Project::findOrFail($this->get('project_id')); + return auth()->user()->can('manage_jobs', $project); } @@ -34,5 +34,4 @@ class UpdateRequest extends Request 'description' => 'max:255', ]; } - } diff --git a/app/Http/Requests/Payments/CreateRequest.php b/app/Http/Requests/Payments/CreateRequest.php index 9f4f3df..5545f4e 100644 --- a/app/Http/Requests/Payments/CreateRequest.php +++ b/app/Http/Requests/Payments/CreateRequest.php @@ -6,7 +6,6 @@ use App\Http\Requests\Request; class CreateRequest extends Request { - /** * Determine if the user is authorized to make this request. * @@ -34,5 +33,4 @@ class CreateRequest extends Request 'description' => 'required|max:255', ]; } - } diff --git a/app/Http/Requests/Payments/DeleteRequest.php b/app/Http/Requests/Payments/DeleteRequest.php index 1462f11..763d06f 100644 --- a/app/Http/Requests/Payments/DeleteRequest.php +++ b/app/Http/Requests/Payments/DeleteRequest.php @@ -4,28 +4,27 @@ namespace App\Http\Requests\Payments; use App\Http\Requests\Request; -class DeleteRequest extends Request { - - /** - * Determine if the user is authorized to make this request. - * - * @return bool - */ - public function authorize() - { - return auth()->user()->can('manage_payments'); - } - - /** - * Get the validation rules that apply to the request. - * - * @return array - */ - public function rules() - { - return [ - 'payment_id' => 'required' - ]; - } +class DeleteRequest extends Request +{ + /** + * Determine if the user is authorized to make this request. + * + * @return bool + */ + public function authorize() + { + return auth()->user()->can('manage_payments'); + } + /** + * Get the validation rules that apply to the request. + * + * @return array + */ + public function rules() + { + return [ + 'payment_id' => 'required', + ]; + } } diff --git a/app/Http/Requests/Payments/UpdateRequest.php b/app/Http/Requests/Payments/UpdateRequest.php index 12a2b11..53dc6b1 100644 --- a/app/Http/Requests/Payments/UpdateRequest.php +++ b/app/Http/Requests/Payments/UpdateRequest.php @@ -6,7 +6,6 @@ use App\Http\Requests\Request; class UpdateRequest extends Request { - /** * Determine if the user is authorized to make this request. * @@ -34,5 +33,4 @@ class UpdateRequest extends Request 'description' => 'required|max:255', ]; } - } diff --git a/app/Http/Requests/Projects/CreateRequest.php b/app/Http/Requests/Projects/CreateRequest.php index 2425cb2..99061af 100644 --- a/app/Http/Requests/Projects/CreateRequest.php +++ b/app/Http/Requests/Projects/CreateRequest.php @@ -7,7 +7,6 @@ use App\Http\Requests\Request; class CreateRequest extends Request { - /** * Determine if the user is authorized to make this request. * @@ -15,7 +14,7 @@ class CreateRequest extends Request */ public function authorize() { - return auth()->user()->can('create', new Project); + return auth()->user()->can('create', new Project()); } /** @@ -43,5 +42,4 @@ class CreateRequest extends Request 'customer_email.required_without' => 'Email Customer Wajib diisi.', ]; } - } diff --git a/app/Http/Requests/Projects/DeleteRequest.php b/app/Http/Requests/Projects/DeleteRequest.php index 6ef805e..9a8fc77 100644 --- a/app/Http/Requests/Projects/DeleteRequest.php +++ b/app/Http/Requests/Projects/DeleteRequest.php @@ -7,7 +7,6 @@ use App\Http\Requests\Request; class DeleteRequest extends Request { - /** * Determine if the user is authorized to make this request. * @@ -16,6 +15,7 @@ class DeleteRequest extends Request public function authorize() { $project = Project::findOrFail($this->segment(2)); + return auth()->user()->can('update', $project); } @@ -30,5 +30,4 @@ class DeleteRequest extends Request 'project_id' => 'required', ]; } - } diff --git a/app/Http/Requests/Projects/UpdateRequest.php b/app/Http/Requests/Projects/UpdateRequest.php index 8c1924c..bf2c0fe 100644 --- a/app/Http/Requests/Projects/UpdateRequest.php +++ b/app/Http/Requests/Projects/UpdateRequest.php @@ -7,7 +7,6 @@ use App\Http\Requests\Request; class UpdateRequest extends Request { - /** * Determine if the user is authorized to make this request. * @@ -16,6 +15,7 @@ class UpdateRequest extends Request public function authorize() { $project = Project::findOrFail($this->segment(2)); + return auth()->user()->can('update', $project); } @@ -37,5 +37,4 @@ class UpdateRequest extends Request 'customer_id' => 'nullable|numeric', ]; } - } diff --git a/app/Http/Requests/SubscriptionRequest.php b/app/Http/Requests/SubscriptionRequest.php index 4cde10a..8d0695c 100644 --- a/app/Http/Requests/SubscriptionRequest.php +++ b/app/Http/Requests/SubscriptionRequest.php @@ -4,11 +4,9 @@ namespace App\Http\Requests; use App\Entities\Projects\Project; use App\Entities\Subscriptions\Subscription; -use App\Http\Requests\Request; class SubscriptionRequest extends Request { - /** * Determine if the user is authorized to make this request. * @@ -47,28 +45,28 @@ class SubscriptionRequest extends Request public function getCreateRules() { return [ - 'name' => 'required|max:60', - 'price' => 'required|numeric', + 'name' => 'required|max:60', + 'price' => 'required|numeric', 'start_date' => 'required|date|date_format:Y-m-d', - 'due_date' => 'required|date|date_format:Y-m-d', + 'due_date' => 'required|date|date_format:Y-m-d', 'project_id' => 'required|numeric|exists:projects,id', - 'vendor_id' => 'required|numeric|exists:vendors,id', - 'type_id' => 'required|numeric', - 'remark' => 'max:255', + 'vendor_id' => 'required|numeric|exists:vendors,id', + 'type_id' => 'required|numeric', + 'remark' => 'max:255', ]; } public function getUpdateRules() { return [ - 'name' => 'required|max:60', - 'price' => 'required|numeric', + 'name' => 'required|max:60', + 'price' => 'required|numeric', 'start_date' => 'required|date|date_format:Y-m-d', - 'due_date' => 'required|date|date_format:Y-m-d', + 'due_date' => 'required|date|date_format:Y-m-d', 'project_id' => 'required|numeric|exists:projects,id', - 'vendor_id' => 'required|numeric|exists:vendors,id', - 'type_id' => 'required|numeric', - 'remark' => 'max:255', + 'vendor_id' => 'required|numeric|exists:vendors,id', + 'type_id' => 'required|numeric', + 'remark' => 'max:255', ]; } @@ -90,9 +88,7 @@ class SubscriptionRequest extends Request $subscriptionData['customer_id'] = $project->customer_id; $subscription->update($subscriptionData); - } else { - $subscription->project_id = $project->id; $subscription->vendor_id = $this->get('vendor_id'); $subscription->customer_id = $project->customer_id; @@ -113,5 +109,4 @@ class SubscriptionRequest extends Request { $subscription->delete(); } - } diff --git a/app/Http/Requests/Tasks/CreateRequest.php b/app/Http/Requests/Tasks/CreateRequest.php index 00909e1..dee99a7 100644 --- a/app/Http/Requests/Tasks/CreateRequest.php +++ b/app/Http/Requests/Tasks/CreateRequest.php @@ -30,5 +30,4 @@ class CreateRequest extends Request 'route_name' => 'max:255', ]; } - } diff --git a/app/Http/Requests/Tasks/DeleteRequest.php b/app/Http/Requests/Tasks/DeleteRequest.php index 55302d1..073af91 100644 --- a/app/Http/Requests/Tasks/DeleteRequest.php +++ b/app/Http/Requests/Tasks/DeleteRequest.php @@ -6,7 +6,6 @@ use App\Http\Requests\Request; class DeleteRequest extends Request { - /** * Determine if the user is authorized to make this request. * @@ -29,5 +28,4 @@ class DeleteRequest extends Request 'job_id' => 'required', ]; } - } diff --git a/app/Http/Requests/Tasks/UpdateRequest.php b/app/Http/Requests/Tasks/UpdateRequest.php index 21e78ea..f848704 100644 --- a/app/Http/Requests/Tasks/UpdateRequest.php +++ b/app/Http/Requests/Tasks/UpdateRequest.php @@ -6,7 +6,6 @@ use App\Http\Requests\Request; class UpdateRequest extends Request { - /** * Determine if the user is authorized to make this request. * @@ -31,5 +30,4 @@ class UpdateRequest extends Request 'route_name' => 'max:255', ]; } - } diff --git a/app/Policies/EventPolicy.php b/app/Policies/EventPolicy.php index ade9380..fdb4fb2 100644 --- a/app/Policies/EventPolicy.php +++ b/app/Policies/EventPolicy.php @@ -7,7 +7,7 @@ use App\Entities\Users\User; use Illuminate\Auth\Access\HandlesAuthorization; /** - * Event model policy class + * Event model policy class. * * @author Nafies Luthfi */ diff --git a/app/Policies/Partners/CustomerPolicy.php b/app/Policies/Partners/CustomerPolicy.php index e8f9cd2..1748ad8 100644 --- a/app/Policies/Partners/CustomerPolicy.php +++ b/app/Policies/Partners/CustomerPolicy.php @@ -7,7 +7,7 @@ use App\Entities\Users\User; use Illuminate\Auth\Access\HandlesAuthorization; /** - * Customer model policy class + * Customer model policy class. * * @author Nafies Luthfi */ @@ -18,8 +18,9 @@ class CustomerPolicy /** * Determine whether the user can view the customer. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Partners\Customer $customer + * @param \App\Entities\Users\User $user + * @param \App\Entities\Partners\Customer $customer + * * @return mixed */ public function view(User $user, Customer $customer) @@ -31,8 +32,9 @@ class CustomerPolicy /** * Determine whether the user can create customers. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Partners\Customer $customer + * @param \App\Entities\Users\User $user + * @param \App\Entities\Partners\Customer $customer + * * @return mixed */ public function create(User $user, Customer $customer) @@ -44,8 +46,9 @@ class CustomerPolicy /** * Determine whether the user can update the customer. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Partners\Customer $customer + * @param \App\Entities\Users\User $user + * @param \App\Entities\Partners\Customer $customer + * * @return mixed */ public function update(User $user, Customer $customer) @@ -57,8 +60,9 @@ class CustomerPolicy /** * Determine whether the user can delete the customer. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Partners\Customer $customer + * @param \App\Entities\Users\User $user + * @param \App\Entities\Partners\Customer $customer + * * @return mixed */ public function delete(User $user, Customer $customer) diff --git a/app/Policies/Partners/VendorPolicy.php b/app/Policies/Partners/VendorPolicy.php index c765ae1..a235722 100644 --- a/app/Policies/Partners/VendorPolicy.php +++ b/app/Policies/Partners/VendorPolicy.php @@ -7,7 +7,7 @@ use App\Entities\Users\User; use Illuminate\Auth\Access\HandlesAuthorization; /** - * Vendor model policy class + * Vendor model policy class. * * @author Nafies Luthfi */ @@ -18,8 +18,9 @@ class VendorPolicy /** * Determine whether the user can view the project. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Partners\Vendor $vendor + * @param \App\Entities\Users\User $user + * @param \App\Entities\Partners\Vendor $vendor + * * @return mixed */ public function view(User $user, Vendor $vendor) @@ -30,8 +31,9 @@ class VendorPolicy /** * Determine whether the user can create projects. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Partners\Vendor $vendor + * @param \App\Entities\Users\User $user + * @param \App\Entities\Partners\Vendor $vendor + * * @return mixed */ public function create(User $user, Vendor $vendor) @@ -42,8 +44,9 @@ class VendorPolicy /** * Determine whether the user can update the project. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Partners\Vendor $vendor + * @param \App\Entities\Users\User $user + * @param \App\Entities\Partners\Vendor $vendor + * * @return mixed */ public function update(User $user, Vendor $vendor) @@ -54,8 +57,9 @@ class VendorPolicy /** * Determine whether the user can delete the project. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Partners\Vendor $vendor + * @param \App\Entities\Users\User $user + * @param \App\Entities\Partners\Vendor $vendor + * * @return mixed */ public function delete(User $user, Vendor $vendor) diff --git a/app/Policies/Projects/ProjectPolicy.php b/app/Policies/Projects/ProjectPolicy.php index 18f725d..28fea7c 100644 --- a/app/Policies/Projects/ProjectPolicy.php +++ b/app/Policies/Projects/ProjectPolicy.php @@ -7,7 +7,7 @@ use App\Entities\Users\User; use Illuminate\Auth\Access\HandlesAuthorization; /** - * Project model policy class + * Project model policy class. * * @author Nafies Luthfi */ @@ -18,8 +18,9 @@ class ProjectPolicy /** * Determine whether the user can view the project. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Projects\Project $project + * @param \App\Entities\Users\User $user + * @param \App\Entities\Projects\Project $project + * * @return mixed */ public function view(User $user, Project $project) @@ -31,8 +32,9 @@ class ProjectPolicy /** * Determine whether the user can create projects. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Projects\Project $project + * @param \App\Entities\Users\User $user + * @param \App\Entities\Projects\Project $project + * * @return mixed */ public function create(User $user, Project $project) @@ -44,8 +46,9 @@ class ProjectPolicy /** * Determine whether the user can update the project. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Projects\Project $project + * @param \App\Entities\Users\User $user + * @param \App\Entities\Projects\Project $project + * * @return mixed */ public function update(User $user, Project $project) @@ -56,8 +59,9 @@ class ProjectPolicy /** * Determine whether the user can delete the project. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Projects\Project $project + * @param \App\Entities\Users\User $user + * @param \App\Entities\Projects\Project $project + * * @return mixed */ public function delete(User $user, Project $project) diff --git a/app/Policies/UserPolicy.php b/app/Policies/UserPolicy.php index 703f15a..624742c 100644 --- a/app/Policies/UserPolicy.php +++ b/app/Policies/UserPolicy.php @@ -7,7 +7,7 @@ use App\Entities\Users\User as Worker; use Illuminate\Auth\Access\HandlesAuthorization; /** - * User model policy class + * User model policy class. * * @author Nafies Luthfi */ @@ -18,8 +18,9 @@ class UserPolicy /** * Determine whether the user can view the user. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Users\User $user + * @param \App\Entities\Users\User $user + * @param \App\Entities\Users\User $user + * * @return mixed */ public function view(User $user, Worker $worker) @@ -30,8 +31,9 @@ class UserPolicy /** * Determine whether the user can create users. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Users\User $user + * @param \App\Entities\Users\User $user + * @param \App\Entities\Users\User $user + * * @return mixed */ public function create(User $user, Worker $worker) @@ -42,8 +44,9 @@ class UserPolicy /** * Determine whether the user can update the user. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Users\User $user + * @param \App\Entities\Users\User $user + * @param \App\Entities\Users\User $user + * * @return mixed */ public function update(User $user, Worker $worker) @@ -54,8 +57,9 @@ class UserPolicy /** * Determine whether the user can delete the user. * - * @param \App\Entities\Users\User $user - * @param \App\Entities\Users\User $user + * @param \App\Entities\Users\User $user + * @param \App\Entities\Users\User $user + * * @return mixed */ public function delete(User $user, Worker $worker) diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 8e4f8b0..25f1272 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -2,7 +2,6 @@ namespace App\Providers; -use App\Entities\Users\Permission; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Gate; diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 9c8572a..907cff8 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -2,8 +2,8 @@ namespace App\Providers; -use Illuminate\Support\Facades\Event; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; +use Illuminate\Support\Facades\Event; class EventServiceProvider extends ServiceProvider { @@ -21,7 +21,8 @@ class EventServiceProvider extends ServiceProvider /** * Register any other events for your application. * - * @param \Illuminate\Contracts\Events\Dispatcher $events + * @param \Illuminate\Contracts\Events\Dispatcher $events + * * @return void */ public function boot() diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 7e6b14f..27303fc 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -2,8 +2,8 @@ namespace App\Providers; -use Illuminate\Support\Facades\Route; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; +use Illuminate\Support\Facades\Route; class RouteServiceProvider extends ServiceProvider { @@ -53,7 +53,7 @@ class RouteServiceProvider extends ServiceProvider { Route::group([ 'middleware' => 'web', - 'namespace' => $this->namespace, + 'namespace' => $this->namespace, ], function ($router) { require base_path('routes/web.php'); }); @@ -70,8 +70,8 @@ class RouteServiceProvider extends ServiceProvider { Route::group([ 'middleware' => 'api', - 'namespace' => $this->namespace, - 'prefix' => 'api', + 'namespace' => $this->namespace, + 'prefix' => 'api', ], function ($router) { require base_path('routes/api.php'); }); diff --git a/app/Queries/AdminDashboardQuery.php b/app/Queries/AdminDashboardQuery.php index 0b8f3b2..b70d8ea 100644 --- a/app/Queries/AdminDashboardQuery.php +++ b/app/Queries/AdminDashboardQuery.php @@ -16,10 +16,11 @@ use Carbon\Carbon; class AdminDashboardQuery { /** - * Get total money earned on an year + * Get total money earned on an year. * - * @param string|integer $year - * @return integer Amount of earnings + * @param string|int $year + * + * @return int Amount of earnings */ public function totalEarnings($year) { @@ -32,14 +33,16 @@ class AdminDashboardQuery $totalEarnings -= $payment->amount; } } + return $totalEarnings; } /** - * Get number of projects that has been finished on a year + * Get number of projects that has been finished on a year. * - * @param string|integer $year - * @return integer Number of finished projects + * @param string|int $year + * + * @return int Number of finished projects */ public function totalFinishedProjects($year) { @@ -47,10 +50,11 @@ class AdminDashboardQuery } /** - * Get current outstanding customer payment amount + * Get current outstanding customer payment amount. + * + * @param string|int $year Year of queried payment records * - * @param string|integer $year Year of queried payment records - * @return integer Amount of outstanding customer payment + * @return int Amount of outstanding customer payment */ public function currentOutstandingCustomerPayment($year) { @@ -74,7 +78,7 @@ class AdminDashboardQuery } /** - * Get list of customer subscriptions that expires on next 60 days + * Get list of customer subscriptions that expires on next 60 days. * * @return \Illuminate\Support\Collection Collection of filtered subscriptions */ @@ -91,9 +95,9 @@ class AdminDashboardQuery } /** - * Get on progress project jobs count + * Get on progress project jobs count. * - * @return integer + * @return int */ public function onProgressJobCount() { diff --git a/app/Services/Facades/Option.php b/app/Services/Facades/Option.php index 43f83b1..0129dd9 100644 --- a/app/Services/Facades/Option.php +++ b/app/Services/Facades/Option.php @@ -5,11 +5,14 @@ namespace App\Services\Facades; use Illuminate\Support\Facades\Facade; /** - * Option facade class + * Option facade class. * * @author Nafies Luthfi */ class Option extends Facade { - protected static function getFacadeAccessor() { return 'option'; } -} \ No newline at end of file + protected static function getFacadeAccessor() + { + return 'option'; + } +} diff --git a/app/Services/InvoiceDraft/InvoiceDraft.php b/app/Services/InvoiceDraft/InvoiceDraft.php index 30eb579..732ebd2 100644 --- a/app/Services/InvoiceDraft/InvoiceDraft.php +++ b/app/Services/InvoiceDraft/InvoiceDraft.php @@ -35,7 +35,8 @@ class InvoiceDraft unset($this->items[$itemKey]); } - function empty() { + public function empty() + { $this->items = []; } diff --git a/app/Services/InvoiceDraft/Item.php b/app/Services/InvoiceDraft/Item.php index 9599e0a..a0c4fec 100644 --- a/app/Services/InvoiceDraft/Item.php +++ b/app/Services/InvoiceDraft/Item.php @@ -15,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 da08c3c..5894b91 100644 --- a/app/Services/Option.php +++ b/app/Services/Option.php @@ -5,13 +5,12 @@ namespace App\Services; use App\Entities\Options\Option as SiteOption; /** - * Option Class (Site Option Service) + * Option Class (Site Option Service). * * @author Nafies Luthfi */ class Option { - protected $option; public function __construct() @@ -31,6 +30,7 @@ class Option if ($option) { return $option->value; } + return $default; } @@ -42,8 +42,8 @@ class Option $option->value = $value; $option->save(); } else { - $option = new SiteOption; - $option->key = $key; + $option = new SiteOption(); + $option->key = $key; $option->value = $value; $option->save(); } diff --git a/app/helpers.php b/app/helpers.php index ca7f8c3..c9145d6 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -1,9 +1,11 @@ [ - 'guard' => 'web', + 'guard' => 'web', 'passwords' => 'users', ], @@ -37,12 +37,12 @@ return [ 'guards' => [ 'web' => [ - 'driver' => 'session', + 'driver' => 'session', 'provider' => 'users', ], 'api' => [ - 'driver' => 'token', + 'driver' => 'token', 'provider' => 'users', ], ], @@ -67,7 +67,7 @@ return [ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => App\Entities\Users\User::class, + 'model' => App\Entities\Users\User::class, ], // 'users' => [ @@ -98,8 +98,8 @@ return [ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', - 'expire' => 60, + 'table' => 'password_resets', + 'expire' => 60, ], ], diff --git a/config/backup-manager.php b/config/backup-manager.php index f2dd3dc..24ccfd8 100644 --- a/config/backup-manager.php +++ b/config/backup-manager.php @@ -6,7 +6,7 @@ return [ 'root' => storage_path('app'), ], 's3' => [ - 'type' => 'AwsS3', + 'type' => 'AwsS3', 'key' => '', 'secret' => '', 'region' => 'us-east-1', @@ -14,48 +14,48 @@ return [ 'root' => '', ], 'gcs' => [ - 'type' => 'Gcs', + 'type' => 'Gcs', 'key' => '', 'secret' => '', 'bucket' => '', 'root' => '', ], 'rackspace' => [ - 'type' => 'Rackspace', - 'username' => '', - 'key' => '', + 'type' => 'Rackspace', + 'username' => '', + 'key' => '', 'container' => '', - 'zone' => '', - 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/', - 'root' => '', + 'zone' => '', + 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/', + 'root' => '', ], 'dropbox' => [ - 'type' => 'Dropbox', - 'token' => '', - 'key' => '', + 'type' => 'Dropbox', + 'token' => '', + 'key' => '', 'secret' => '', - 'app' => '', - 'root' => '', + 'app' => '', + 'root' => '', ], 'ftp' => [ - 'type' => 'Ftp', - 'host' => '', + 'type' => 'Ftp', + 'host' => '', 'username' => '', 'password' => '', - 'port' => 21, - 'passive' => true, - 'ssl' => true, - 'timeout' => 30, - 'root' => '', + 'port' => 21, + 'passive' => true, + 'ssl' => true, + 'timeout' => 30, + 'root' => '', ], 'sftp' => [ - 'type' => 'Sftp', - 'host' => '', - 'username' => '', - 'password' => '', - 'port' => 21, - 'timeout' => 10, + 'type' => 'Sftp', + 'host' => '', + 'username' => '', + 'password' => '', + 'port' => 21, + 'timeout' => 10, 'privateKey' => '', - 'root' => '', + 'root' => '', ], ]; diff --git a/config/broadcasting.php b/config/broadcasting.php index abaaac3..6207fd4 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -29,17 +29,17 @@ return [ 'connections' => [ 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_KEY'), - 'secret' => env('PUSHER_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), + 'driver' => 'pusher', + 'key' => env('PUSHER_KEY'), + 'secret' => env('PUSHER_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), 'options' => [ // ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/config/cache.php b/config/cache.php index b00a998..8446b53 100644 --- a/config/cache.php +++ b/config/cache.php @@ -37,8 +37,8 @@ return [ ], 'database' => [ - 'driver' => 'database', - 'table' => 'cache', + 'driver' => 'database', + 'table' => 'cache', 'connection' => null, ], @@ -51,15 +51,15 @@ return [ 'driver' => 'memcached', 'servers' => [ [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/config/filesystems.php b/config/filesystems.php index 75b5002..7d0d0ed 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -45,18 +45,18 @@ return [ 'local' => [ 'driver' => 'local', - 'root' => storage_path('app'), + 'root' => storage_path('app'), ], 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/public'), + 'driver' => 'local', + 'root' => storage_path('app/public'), 'visibility' => 'public', ], 's3' => [ 'driver' => 's3', - 'key' => 'your-key', + 'key' => 'your-key', 'secret' => 'your-secret', 'region' => 'your-region', 'bucket' => 'your-bucket', diff --git a/database/factories/CustomerFactory.php b/database/factories/CustomerFactory.php index 20b20e5..e7bac65 100644 --- a/database/factories/CustomerFactory.php +++ b/database/factories/CustomerFactory.php @@ -1,11 +1,9 @@ define(Customer::class, function (Faker $faker) { - return [ 'name' => $faker->company, ]; diff --git a/database/factories/InvoiceFactory.php b/database/factories/InvoiceFactory.php index 73b9610..ede872f 100644 --- a/database/factories/InvoiceFactory.php +++ b/database/factories/InvoiceFactory.php @@ -10,7 +10,7 @@ $factory->define(Invoice::class, function (Faker $faker) { 'project_id' => function () { return factory(Project::class)->create()->id; }, - 'number' => (new Invoice)->generateNewNumber(), + 'number' => (new Invoice())->generateNewNumber(), 'items' => [], 'date' => '2010-10-10', 'amount' => 100000, diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index a63d5a8..bf5b636 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -17,7 +17,6 @@ $factory->define(User::class, function (Faker\Generator $faker) { }); $factory->define(Job::class, function (Faker\Generator $faker) { - return [ 'project_id' => function () { return factory(Project::class)->create()->id; @@ -34,7 +33,6 @@ $factory->define(Job::class, function (Faker\Generator $faker) { }); $factory->define(Task::class, function (Faker\Generator $faker) { - return [ 'job_id' => function () { return factory(Job::class)->create()->id; @@ -47,7 +45,6 @@ $factory->define(Task::class, function (Faker\Generator $faker) { }); $factory->define(Event::class, function (Faker\Generator $faker) { - return [ 'user_id' => function () { return factory(User::class)->create()->id; diff --git a/database/factories/PaymentFactory.php b/database/factories/PaymentFactory.php index 7f34824..1e628b8 100644 --- a/database/factories/PaymentFactory.php +++ b/database/factories/PaymentFactory.php @@ -8,7 +8,6 @@ use App\Entities\Users\User; use Faker\Generator as Faker; $factory->define(Payment::class, function (Faker $faker) { - return [ 'project_id' => function () { return factory(Project::class)->create()->id; @@ -26,12 +25,10 @@ $factory->define(Payment::class, function (Faker $faker) { }); $factory->state(Payment::class, 'customer', function (Faker $faker) { - return []; }); $factory->state(Payment::class, 'vendor', function (Faker $faker) { - return [ 'in_out' => 0, 'type_id' => 1, @@ -43,7 +40,6 @@ $factory->state(Payment::class, 'vendor', function (Faker $faker) { }); $factory->state(Payment::class, 'fee', function (Faker $faker) { - return [ 'in_out' => 0, 'type_id' => 1, diff --git a/database/factories/ProjectFactory.php b/database/factories/ProjectFactory.php index b16849b..ca7b25a 100644 --- a/database/factories/ProjectFactory.php +++ b/database/factories/ProjectFactory.php @@ -1,15 +1,13 @@ define(Project::class, function (Faker $faker) { - $proposalDate = $faker->dateTimeBetween('-1 year', '-1 month')->format('Y-m-d'); - $startDate = Carbon::parse($proposalDate)->addDays(10); - $endDate = $startDate->addDays(rand(1, 13) * 7); + $startDate = Carbon::parse($proposalDate)->addDays(10); + $endDate = $startDate->addDays(rand(1, 13) * 7); return [ 'name' => $faker->sentence(3), diff --git a/database/factories/SubscriptionFactory.php b/database/factories/SubscriptionFactory.php index 3dd9d3e..feacd48 100644 --- a/database/factories/SubscriptionFactory.php +++ b/database/factories/SubscriptionFactory.php @@ -8,19 +8,18 @@ use Carbon\Carbon; use Faker\Generator as Faker; $factory->define(Subscription::class, function (Faker $faker) { - $startDate = Carbon::parse($faker->dateTimeBetween('-1 year', '-1 month')->format('Y-m-d')); return [ 'project_id' => function () { return factory(Project::class)->create()->id; }, - 'type_id' => 1, - 'status_id' => 1, - 'name' => 'www.'.str_random(10).'.com', - 'price' => 125000, - 'start_date' => $startDate->format('Y-m-d'), - 'due_date' => $startDate->addYears(1)->format('Y-m-d'), + 'type_id' => 1, + 'status_id' => 1, + 'name' => 'www.'.str_random(10).'.com', + 'price' => 125000, + 'start_date' => $startDate->format('Y-m-d'), + 'due_date' => $startDate->addYears(1)->format('Y-m-d'), 'customer_id' => function () { return factory(Customer::class)->create()->id; }, diff --git a/database/factories/VendorFactory.php b/database/factories/VendorFactory.php index c22d568..af41bd8 100644 --- a/database/factories/VendorFactory.php +++ b/database/factories/VendorFactory.php @@ -4,7 +4,6 @@ use App\Entities\Partners\Vendor; use Faker\Generator as Faker; $factory->define(Vendor::class, function (Faker $faker) { - return [ 'name' => $faker->company, ]; diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index eb0bbd5..b96f2cc 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -1,7 +1,7 @@ increments('id'); $table->string('name'); $table->string('email')->unique(); diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php index c22bc74..c647b56 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_password_resets_table.php @@ -1,7 +1,7 @@ string('email')->index(); $table->string('token')->index(); $table->timestamp('created_at'); diff --git a/database/migrations/2015_07_14_131409_create_site_options_table.php b/database/migrations/2015_07_14_131409_create_site_options_table.php index 562727e..0d3155c 100644 --- a/database/migrations/2015_07_14_131409_create_site_options_table.php +++ b/database/migrations/2015_07_14_131409_create_site_options_table.php @@ -1,7 +1,7 @@ increments('id'); $table->string('key', 60)->index(); $table->string('value'); diff --git a/database/migrations/2016_07_06_110052_create_projects_table.php b/database/migrations/2016_07_06_110052_create_projects_table.php index 7b99f19..d565832 100644 --- a/database/migrations/2016_07_06_110052_create_projects_table.php +++ b/database/migrations/2016_07_06_110052_create_projects_table.php @@ -3,40 +3,37 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; -class CreateProjectsTable extends Migration { - - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('projects', function(Blueprint $table) - { - $table->increments('id'); - $table->string('name', 60); - $table->string('description')->nullable(); - $table->date('proposal_date')->nullable(); - $table->date('start_date')->nullable(); - $table->date('end_date')->nullable(); - $table->integer('project_value')->unsigned(); - $table->integer('proposal_value')->unsigned()->nullable(); - $table->boolean('status_id')->default(1)->comment('1: planned, 2: on progress, 3: done, 4: closed, 5: canceled, 6: on hold '); - $table->integer('customer_id')->unsigned(); - $table->timestamps(); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('projects'); - } +class CreateProjectsTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('projects', function (Blueprint $table) { + $table->increments('id'); + $table->string('name', 60); + $table->string('description')->nullable(); + $table->date('proposal_date')->nullable(); + $table->date('start_date')->nullable(); + $table->date('end_date')->nullable(); + $table->integer('project_value')->unsigned(); + $table->integer('proposal_value')->unsigned()->nullable(); + $table->boolean('status_id')->default(1)->comment('1: planned, 2: on progress, 3: done, 4: closed, 5: canceled, 6: on hold '); + $table->integer('customer_id')->unsigned(); + $table->timestamps(); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('projects'); + } } diff --git a/database/migrations/2016_07_08_182606_create_subscriptions_table.php b/database/migrations/2016_07_08_182606_create_subscriptions_table.php index 1a2190a..4999e02 100644 --- a/database/migrations/2016_07_08_182606_create_subscriptions_table.php +++ b/database/migrations/2016_07_08_182606_create_subscriptions_table.php @@ -37,5 +37,4 @@ class CreateSubscriptionsTable extends Migration { Schema::drop('subscriptions'); } - } diff --git a/database/migrations/2016_07_09_093439_create_jobs_table.php b/database/migrations/2016_07_09_093439_create_jobs_table.php index d78b412..bae2468 100644 --- a/database/migrations/2016_07_09_093439_create_jobs_table.php +++ b/database/migrations/2016_07_09_093439_create_jobs_table.php @@ -5,7 +5,6 @@ use Illuminate\Database\Schema\Blueprint; class CreateJobsTable extends Migration { - /** * Run the migrations. * @@ -35,5 +34,4 @@ class CreateJobsTable extends Migration { Schema::drop('jobs'); } - } diff --git a/database/migrations/2016_07_09_142833_create_tasks_table.php b/database/migrations/2016_07_09_142833_create_tasks_table.php index c27d70e..815c16c 100644 --- a/database/migrations/2016_07_09_142833_create_tasks_table.php +++ b/database/migrations/2016_07_09_142833_create_tasks_table.php @@ -5,7 +5,6 @@ use Illuminate\Database\Schema\Blueprint; class CreateTasksTable extends Migration { - /** * Run the migrations. * @@ -33,5 +32,4 @@ class CreateTasksTable extends Migration { Schema::drop('tasks'); } - } diff --git a/database/migrations/2016_11_15_151228_create_payments_table.php b/database/migrations/2016_11_15_151228_create_payments_table.php index 96bd251..0941866 100644 --- a/database/migrations/2016_11_15_151228_create_payments_table.php +++ b/database/migrations/2016_11_15_151228_create_payments_table.php @@ -5,7 +5,6 @@ use Illuminate\Database\Schema\Blueprint; class CreatePaymentsTable extends Migration { - /** * Run the migrations. * @@ -36,5 +35,4 @@ class CreatePaymentsTable extends Migration { Schema::drop('payments'); } - } diff --git a/database/migrations/2016_11_25_145359_create_user_events_table.php b/database/migrations/2016_11_25_145359_create_user_events_table.php index c00bc5f..2da4558 100644 --- a/database/migrations/2016_11_25_145359_create_user_events_table.php +++ b/database/migrations/2016_11_25_145359_create_user_events_table.php @@ -3,38 +3,35 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; -class CreateUserEventsTable extends Migration { - - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('user_events', function(Blueprint $table) - { - $table->increments('id'); - $table->integer('user_id')->unsigned(); - $table->integer('project_id')->unsigned()->nullable(); - $table->string('title', 60); - $table->string('body')->nullable(); - $table->dateTime('start')->nullable(); - $table->dateTime('end')->nullable(); - $table->boolean('is_allday')->default(0); - $table->timestamps(); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('user_events'); - } +class CreateUserEventsTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('user_events', function (Blueprint $table) { + $table->increments('id'); + $table->integer('user_id')->unsigned(); + $table->integer('project_id')->unsigned()->nullable(); + $table->string('title', 60); + $table->string('body')->nullable(); + $table->dateTime('start')->nullable(); + $table->dateTime('end')->nullable(); + $table->boolean('is_allday')->default(0); + $table->timestamps(); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('user_events'); + } } diff --git a/database/migrations/2017_08_03_235706_create_files_table.php b/database/migrations/2017_08_03_235706_create_files_table.php index 6712f35..3a7fead 100644 --- a/database/migrations/2017_08_03_235706_create_files_table.php +++ b/database/migrations/2017_08_03_235706_create_files_table.php @@ -1,8 +1,8 @@ */ diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index e5506df..6ef1a73 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -13,7 +13,7 @@ return [ | */ - 'failed' => 'These credentials do not match our records.', + 'failed' => 'These credentials do not match our records.', 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', ]; diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php index e5544d2..ffa19ba 100644 --- a/resources/lang/en/passwords.php +++ b/resources/lang/en/passwords.php @@ -14,9 +14,9 @@ return [ */ 'password' => 'Passwords must be at least six characters and match the confirmation.', - 'reset' => 'Your password has been reset!', - 'sent' => 'We have e-mailed your password reset link!', - 'token' => 'This password reset token is invalid.', - 'user' => "We can't find a user with that e-mail address.", + 'reset' => 'Your password has been reset!', + 'sent' => 'We have e-mailed your password reset link!', + 'token' => 'This password reset token is invalid.', + 'user' => "We can't find a user with that e-mail address.", ]; diff --git a/resources/lang/id/option.php b/resources/lang/id/option.php index ee2f41f..b509661 100644 --- a/resources/lang/id/option.php +++ b/resources/lang/id/option.php @@ -11,4 +11,4 @@ return [ 'key' => 'Key', 'value' => 'Value', 'updated' => 'Value', -]; \ No newline at end of file +]; diff --git a/resources/lang/id/passwords.php b/resources/lang/id/passwords.php index 8cab930..6659543 100644 --- a/resources/lang/id/passwords.php +++ b/resources/lang/id/passwords.php @@ -13,9 +13,9 @@ return [ | */ - "password" => "Password harus minimal enam karakter dan cocok dengan konfirmasi.", - "user" => "Kami tidak dapat menemukan pengguna dengan email tersebut.", - "token" => "Token Reset Password tidak sah.", - "sent" => "Kami sudah mengirim email yang berisi tautan untuk mereset Password Anda!", - "reset" => "Password Anda sudah direset!", + 'password' => 'Password harus minimal enam karakter dan cocok dengan konfirmasi.', + 'user' => 'Kami tidak dapat menemukan pengguna dengan email tersebut.', + 'token' => 'Token Reset Password tidak sah.', + 'sent' => 'Kami sudah mengirim email yang berisi tautan untuk mereset Password Anda!', + 'reset' => 'Password Anda sudah direset!', ]; diff --git a/resources/lang/id/permission.php b/resources/lang/id/permission.php index 62bbd75..cbbc740 100644 --- a/resources/lang/id/permission.php +++ b/resources/lang/id/permission.php @@ -19,4 +19,4 @@ return [ 'roles_count' => 'Jumlah Grup', 'empty' => 'Belum ada Hak Akses', 'back_to_index' => 'Kembali ke daftar Hak Akses', -]; \ No newline at end of file +]; diff --git a/resources/lang/id/role.php b/resources/lang/id/role.php index e3cc4ec..2f19cb2 100644 --- a/resources/lang/id/role.php +++ b/resources/lang/id/role.php @@ -19,4 +19,4 @@ return [ 'users_count' => 'Jumlah User', 'empty' => 'Belum ada Grup', 'back_to_index' => 'Kembali ke daftar Grup', -]; \ No newline at end of file +]; diff --git a/resources/lang/id/validation.php b/resources/lang/id/validation.php index f776e0e..a4a7a28 100644 --- a/resources/lang/id/validation.php +++ b/resources/lang/id/validation.php @@ -13,69 +13,69 @@ return [ | */ - "accepted" => "Isian :attribute harus diterima.", - "active_url" => "Isian :attribute bukan URL yang valid.", - "after" => "Isian :attribute harus tanggal setelah :date.", - "alpha" => "Isian :attribute hanya boleh berisi huruf.", - "alpha_dash" => "Isian :attribute hanya boleh berisi huruf, angka, dan strip.", - "alpha_num" => "Isian :attribute hanya boleh berisi huruf dan angka.", - "array" => "Isian :attribute harus berupa sebuah array.", - "before" => "Isian :attribute harus tanggal sebelum :date.", - "between" => [ - "numeric" => "Isian :attribute harus antara :min dan :max.", - "file" => "Isian :attribute harus antara :min dan :max kilobytes.", - "string" => "Isian :attribute harus antara :min dan :max karakter.", - "array" => "Isian :attribute harus antara :min dan :max item.", + 'accepted' => 'Isian :attribute harus diterima.', + 'active_url' => 'Isian :attribute bukan URL yang valid.', + 'after' => 'Isian :attribute harus tanggal setelah :date.', + 'alpha' => 'Isian :attribute hanya boleh berisi huruf.', + 'alpha_dash' => 'Isian :attribute hanya boleh berisi huruf, angka, dan strip.', + 'alpha_num' => 'Isian :attribute hanya boleh berisi huruf dan angka.', + 'array' => 'Isian :attribute harus berupa sebuah array.', + 'before' => 'Isian :attribute harus tanggal sebelum :date.', + 'between' => [ + 'numeric' => 'Isian :attribute harus antara :min dan :max.', + 'file' => 'Isian :attribute harus antara :min dan :max kilobytes.', + 'string' => 'Isian :attribute harus antara :min dan :max karakter.', + 'array' => 'Isian :attribute harus antara :min dan :max item.', ], - "boolean" => "Isian :attribute harus berupa true atau false", - "confirmed" => "Konfirmasi :attribute tidak cocok.", - "date" => "Isian :attribute bukan tanggal yang valid.", - "date_format" => "Isian :attribute tidak cocok dengan format :format.", - "different" => "Isian :attribute dan :other harus berbeda.", - "digits" => "Isian :attribute harus berupa angka :digits.", - "digits_between" => "Isian :attribute harus antara angka :min dan :max.", + 'boolean' => 'Isian :attribute harus berupa true atau false', + 'confirmed' => 'Konfirmasi :attribute tidak cocok.', + 'date' => 'Isian :attribute bukan tanggal yang valid.', + 'date_format' => 'Isian :attribute tidak cocok dengan format :format.', + 'different' => 'Isian :attribute dan :other harus berbeda.', + 'digits' => 'Isian :attribute harus berupa angka :digits.', + 'digits_between' => 'Isian :attribute harus antara angka :min dan :max.', 'dimensions' => 'Dimensi file gambar :attribute tidak sesuai.', - "email" => "Isian :attribute harus berupa alamat surel yang valid.", - "exists" => "Isian :attribute yang dipilih tidak valid.", - "filled" => "Bidang isian :attribute wajib diisi.", - "image" => "Isian :attribute harus berupa gambar.", - "in" => "Isian :attribute yang dipilih tidak valid.", - "integer" => "Isian :attribute harus merupakan bilangan bulat.", - "ip" => "Isian :attribute harus berupa alamat IP yang valid.", + 'email' => 'Isian :attribute harus berupa alamat surel yang valid.', + 'exists' => 'Isian :attribute yang dipilih tidak valid.', + 'filled' => 'Bidang isian :attribute wajib diisi.', + 'image' => 'Isian :attribute harus berupa gambar.', + 'in' => 'Isian :attribute yang dipilih tidak valid.', + 'integer' => 'Isian :attribute harus merupakan bilangan bulat.', + 'ip' => 'Isian :attribute harus berupa alamat IP yang valid.', 'json' => 'The :attribute must be a valid JSON string.', - "max" => [ - "numeric" => "Isian :attribute seharusnya tidak lebih dari :max.", - "file" => "Isian :attribute seharusnya tidak lebih dari :max kilobytes.", - "string" => "Isian :attribute seharusnya tidak lebih dari :max karakter.", - "array" => "Isian :attribute seharusnya tidak lebih dari :max item.", + 'max' => [ + 'numeric' => 'Isian :attribute seharusnya tidak lebih dari :max.', + 'file' => 'Isian :attribute seharusnya tidak lebih dari :max kilobytes.', + 'string' => 'Isian :attribute seharusnya tidak lebih dari :max karakter.', + 'array' => 'Isian :attribute seharusnya tidak lebih dari :max item.', ], - "mimes" => "Isian :attribute harus dokumen berjenis : :values.", - "min" => [ - "numeric" => "Isian :attribute harus minimal :min.", - "file" => "Isian :attribute harus minimal :min kilobytes.", - "string" => "Isian :attribute harus minimal :min karakter.", - "array" => "Isian :attribute harus minimal :min item.", + 'mimes' => 'Isian :attribute harus dokumen berjenis : :values.', + 'min' => [ + 'numeric' => 'Isian :attribute harus minimal :min.', + 'file' => 'Isian :attribute harus minimal :min kilobytes.', + 'string' => 'Isian :attribute harus minimal :min karakter.', + 'array' => 'Isian :attribute harus minimal :min item.', ], - "not_in" => "Isian :attribute yang dipilih tidak valid.", - "numeric" => "Isian :attribute harus berupa angka.", - "regex" => "Format isian :attribute tidak valid.", - "required" => "Wajib diisi.", - "required_if" => "Bidang isian :attribute wajib diisi bila :other adalah :value.", - "required_with" => "Bidang isian :attribute wajib diisi bila terdapat :values.", - "required_with_all" => "Bidang isian :attribute wajib diisi bila terdapat :values.", - "required_without" => "Bidang isian :attribute wajib diisi bila tidak terdapat :values.", - "required_without_all" => "Bidang isian :attribute wajib diisi bila tidak terdapat ada :values.", - "same" => "Isian :attribute dan :other harus sama.", - "size" => [ - "numeric" => "Isian :attribute harus berukuran :size.", - "file" => "Isian :attribute harus berukuran :size kilobyte.", - "string" => "Isian :attribute harus berukuran :size karakter.", - "array" => "Isian :attribute harus mengandung :size item.", + 'not_in' => 'Isian :attribute yang dipilih tidak valid.', + 'numeric' => 'Isian :attribute harus berupa angka.', + 'regex' => 'Format isian :attribute tidak valid.', + 'required' => 'Wajib diisi.', + 'required_if' => 'Bidang isian :attribute wajib diisi bila :other adalah :value.', + 'required_with' => 'Bidang isian :attribute wajib diisi bila terdapat :values.', + 'required_with_all' => 'Bidang isian :attribute wajib diisi bila terdapat :values.', + 'required_without' => 'Bidang isian :attribute wajib diisi bila tidak terdapat :values.', + 'required_without_all' => 'Bidang isian :attribute wajib diisi bila tidak terdapat ada :values.', + 'same' => 'Isian :attribute dan :other harus sama.', + 'size' => [ + 'numeric' => 'Isian :attribute harus berukuran :size.', + 'file' => 'Isian :attribute harus berukuran :size kilobyte.', + 'string' => 'Isian :attribute harus berukuran :size karakter.', + 'array' => 'Isian :attribute harus mengandung :size item.', ], - "string" => "Isian :attribute harus berupa string.", - "timezone" => "Isian :attribute harus berupa zona waktu yang valid.", - "unique" => "Isian :attribute sudah ada sebelumnya.", - "url" => "Format isian :attribute tidak valid.", + 'string' => 'Isian :attribute harus berupa string.', + 'timezone' => 'Isian :attribute harus berupa zona waktu yang valid.', + 'unique' => 'Isian :attribute sudah ada sebelumnya.', + 'url' => 'Format isian :attribute tidak valid.', /* |--------------------------------------------------------------------------------------- diff --git a/routes/api.php b/routes/api.php index cd59c5b..df7f5ca 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,8 +1,8 @@ 'v1','namespace' => 'Api', 'as' => 'api.', 'middleware' => ['auth:api']], function() { - require __DIR__ . '/api/projects.php'; - /** +Route::group(['prefix' => 'v1', 'namespace' => 'Api', 'as' => 'api.', 'middleware' => ['auth:api']], function () { + require __DIR__.'/api/projects.php'; + /* * Calendar */ Route::get('get-events', ['as' => 'events.index', 'uses' => 'EventsController@index']); @@ -10,4 +10,4 @@ Route::group(['prefix' => 'v1','namespace' => 'Api', 'as' => 'api.', 'middleware Route::patch('events/update', ['as' => 'events.update', 'uses' => 'EventsController@update']); Route::patch('events/reschedule', ['as' => 'events.reschedule', 'uses' => 'EventsController@reschedule']); Route::delete('events/delete', ['as' => 'events.destroy', 'uses' => 'EventsController@destroy']); -}); \ No newline at end of file +}); diff --git a/routes/web.php b/routes/web.php index 1f051ef..ab71887 100644 --- a/routes/web.php +++ b/routes/web.php @@ -12,7 +12,7 @@ require __DIR__.'/web/options-vue.php'; require __DIR__.'/web/calendar.php'; Route::group(['middleware' => ['web', 'auth']], function () { - /** + /* * Subscriptions Routes */ Route::resource('subscriptions', 'SubscriptionsController'); diff --git a/routes/web/account.php b/routes/web/account.php index f8c0c4e..fe97235 100644 --- a/routes/web/account.php +++ b/routes/web/account.php @@ -1,6 +1,6 @@ 'web'], function () { Route::get('app-install', ['as' => 'app.install', 'uses' => 'InstallationController@index']); diff --git a/routes/web/calendar.php b/routes/web/calendar.php index 47e9530..5786a9a 100644 --- a/routes/web/calendar.php +++ b/routes/web/calendar.php @@ -1,11 +1,12 @@ ['web','auth'], 'namespace' => 'Api'], function() { - /** +Route::group(['middleware' => ['web', 'auth'], 'namespace' => 'Api'], function () { + /* * Savety Calendar */ - Route::get('my-calendar', ['as' => 'users.calendar', 'uses' => function() { + Route::get('my-calendar', ['as' => 'users.calendar', 'uses' => function () { $projects = App\Entities\Projects\Project::orderBy('name')->pluck('name', 'id'); + return view('users.calendar', compact('projects')); }]); -}); \ No newline at end of file +}); diff --git a/routes/web/invoices.php b/routes/web/invoices.php index 8b238b0..f8d6b82 100644 --- a/routes/web/invoices.php +++ b/routes/web/invoices.php @@ -22,7 +22,7 @@ Route::group(['middleware' => ['web', 'role:admin'], 'namespace' => 'Invoices'], Route::get('invoices/{invoice}/pdf', ['as' => 'invoices.pdf', 'uses' => 'InvoicesController@pdf']); Route::resource('invoices', 'InvoicesController'); - /** + /* * Invoice Items Routes */ Route::post('invoices/{invoice}/items', ['as' => 'invoices.items.store', 'uses' => 'ItemsController@store']); diff --git a/routes/web/options-vue.php b/routes/web/options-vue.php index 1125c3e..ac1e4ad 100644 --- a/routes/web/options-vue.php +++ b/routes/web/options-vue.php @@ -1,27 +1,28 @@ 'api/options'], function() { - Route::match(['GET','POST'], '/', function() { - if (Request::isMethod('GET')) +Route::group(['prefix'=>'api/options'], function () { + Route::match(['GET', 'POST'], '/', function () { + if (Request::isMethod('GET')) { return App\Entities\Options\Option::all(); - else { - return App\Entities\Options\Option::create(Request::only('key','value')); + } else { + return App\Entities\Options\Option::create(Request::only('key', 'value')); } }); - Route::match(['GET','PATCH','DELETE'], '/{id}', function($id) { - if (Request::isMethod('GET')) + Route::match(['GET', 'PATCH', 'DELETE'], '/{id}', function ($id) { + if (Request::isMethod('GET')) { return App\Entities\Options\Option::findOrFail($id); - else if (Request::isMethod('PATCH')) { - App\Entities\Options\Option::findOrFail($id)->update(Request::only('key','value')); + } elseif (Request::isMethod('PATCH')) { + App\Entities\Options\Option::findOrFail($id)->update(Request::only('key', 'value')); + return Response::json(Request::all()); } else { return App\Entities\Options\Option::destroy($id); @@ -57,5 +58,4 @@ Route::group(['prefix'=>'api/options'], function() { // return 'ok'; // }); - -/** end of Vue js Trial */ \ No newline at end of file +/* end of Vue js Trial */ diff --git a/routes/web/pages.php b/routes/web/pages.php index 7521833..a849cba 100644 --- a/routes/web/pages.php +++ b/routes/web/pages.php @@ -1,8 +1,10 @@ route('home');}); +Route::get('/', function () { + return redirect()->route('home'); +}); Route::get('about', ['as' => 'about', 'uses' => 'PagesController@about', 'middleware' => ['web']]); Route::get('home', ['as' => 'home', 'uses' => 'PagesController@home', 'middleware' => ['web', 'auth']]); diff --git a/routes/web/payments.php b/routes/web/payments.php index 4993e44..99c0710 100644 --- a/routes/web/payments.php +++ b/routes/web/payments.php @@ -1,7 +1,7 @@ ['web', 'role:admin']], function () { - /** + /* * Payments Routes */ Route::get('payments/{payment}/pdf', ['as' => 'payments.pdf', 'uses' => 'PaymentsController@pdf']); diff --git a/routes/web/projects.php b/routes/web/projects.php index b8791ff..13db115 100644 --- a/routes/web/projects.php +++ b/routes/web/projects.php @@ -1,7 +1,7 @@ ['web', 'role:admin'], 'namespace' => 'Projects'], function () { - /** + /* * Projects Routes */ Route::get('projects/{id}/delete', ['as' => 'projects.delete', 'uses' => 'ProjectsController@delete']); @@ -9,23 +9,23 @@ Route::group(['middleware' => ['web', 'role:admin'], 'namespace' => 'Projects'], Route::patch('projects/{id}/status-update', ['as' => 'projects.status-update', 'uses' => 'ProjectsController@statusUpdate']); Route::resource('projects', 'ProjectsController'); - /** + /* * Project Payments Routes */ Route::get('projects/{id}/payments', ['as' => 'projects.payments', 'uses' => 'ProjectsController@payments']); - /** + /* * Project Fees Routes */ Route::get('projects/{project}/fees/create', ['as' => 'projects.fees.create', 'uses' => 'FeesController@create']); Route::post('projects/{project}/fees/store', ['as' => 'projects.fees.store', 'uses' => 'FeesController@store']); - /** + /* * Project Invoices Routes */ Route::get('projects/{project}/invoices', ['as' => 'projects.invoices', 'uses' => 'InvoicesController@index']); - /** + /* * Project Jobs Routes */ Route::get('projects/{project}/jobs-export/{type?}', ['as' => 'projects.jobs-export', 'uses' => 'JobsController@jobsExport']); @@ -36,7 +36,7 @@ Route::group(['middleware' => ['web', 'role:admin'], 'namespace' => 'Projects'], Route::get('projects/{project}/jobs', ['as' => 'projects.jobs.index', 'uses' => 'JobsController@index']); Route::post('projects/{id}/jobs-reorder', ['as' => 'projects.jobs-reorder', 'uses' => 'ProjectsController@jobsReorder']); - /** + /* * Tasks Routes */ Route::get('jobs/{id}/tasks/create', ['as' => 'tasks.create', 'uses' => 'TasksController@create']); @@ -44,7 +44,7 @@ Route::group(['middleware' => ['web', 'role:admin'], 'namespace' => 'Projects'], Route::patch('task/{id}', ['as' => 'tasks.update', 'uses' => 'TasksController@update']); Route::delete('task/{id}', ['as' => 'tasks.destroy', 'uses' => 'TasksController@destroy']); - /** + /* * Files Routes */ Route::get('projects/{project}/files', ['as' => 'projects.files', 'uses' => 'FilesController@index']); @@ -55,7 +55,7 @@ Route::group(['middleware' => ['web', 'role:admin'], 'namespace' => 'Projects'], Route::group(['middleware' => ['web', 'auth']], function () { - /** + /* * Jobs Routes */ Route::get('jobs', ['as' => 'jobs.index', 'uses' => 'JobsController@index']); @@ -64,7 +64,7 @@ Route::group(['middleware' => ['web', 'auth']], function () { Route::group(['middleware' => ['web', 'role:admin']], function () { - /** + /* * Job Actions Routes */ Route::get('jobs/{job}/edit', ['as' => 'jobs.edit', 'uses' => 'JobsController@edit']); diff --git a/routes/web/references.php b/routes/web/references.php index 8adaeb0..439d789 100644 --- a/routes/web/references.php +++ b/routes/web/references.php @@ -1,7 +1,7 @@ 'References', 'middleware' => ['web', 'role:admin']], function () { - /** + /* * Options Routes */ Route::get('options', ['as' => 'options.index', 'uses' => 'OptionsController@index']); diff --git a/routes/web/reports.php b/routes/web/reports.php index 1d87fff..2d4d867 100644 --- a/routes/web/reports.php +++ b/routes/web/reports.php @@ -1,7 +1,7 @@ ['web', 'role:admin'], 'prefix' => 'reports'], function () { - /** + /* * Reports Routes */ Route::get('payments', ['as' => 'reports.payments.index', 'uses' => 'ReportsController@monthly']); diff --git a/routes/web/users.php b/routes/web/users.php index dd472c8..0fda32b 100644 --- a/routes/web/users.php +++ b/routes/web/users.php @@ -1,7 +1,7 @@ ['web', 'role:admin'], 'namespace' => 'Users'], function () { - /** + /* * Users Routes */ Route::get('users/{user}/delete', ['as' => 'users.delete', 'uses' => 'UsersController@delete']); diff --git a/server.php b/server.php index f65c7c4..1b4655b 100644 --- a/server.php +++ b/server.php @@ -1,12 +1,10 @@ */ - $uri = urldecode( parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ); diff --git a/tests/Feature/AgencyProfileTest.php b/tests/Feature/AgencyProfileTest.php index 1eb0794..c2279f5 100644 --- a/tests/Feature/AgencyProfileTest.php +++ b/tests/Feature/AgencyProfileTest.php @@ -5,7 +5,7 @@ namespace Tests\Feature\Users; use Tests\TestCase; /** - * Agency Profile Controller + * Agency Profile Controller. * * @author Nafies Luthfi */ diff --git a/tests/Feature/Api/ApiEventsTest.php b/tests/Feature/Api/ApiEventsTest.php index 93a3339..08e0f18 100644 --- a/tests/Feature/Api/ApiEventsTest.php +++ b/tests/Feature/Api/ApiEventsTest.php @@ -8,7 +8,7 @@ use App\Entities\Users\User; use Tests\TestCase; /** - * Manage Events API Feature Test + * Manage Events API Feature Test. * * @author Nafies Luthfi */ diff --git a/tests/Feature/Api/ApiManageProjectsTest.php b/tests/Feature/Api/ApiManageProjectsTest.php index 3d7b95d..a0f216d 100644 --- a/tests/Feature/Api/ApiManageProjectsTest.php +++ b/tests/Feature/Api/ApiManageProjectsTest.php @@ -6,7 +6,7 @@ use App\Entities\Projects\Project; use Tests\TestCase; /** - * Manage Projects API Feature Test + * Manage Projects API Feature Test. * * @author Nafies Luthfi */ diff --git a/tests/Feature/Auth/ResetPasswordTest.php b/tests/Feature/Auth/ResetPasswordTest.php index 6d18817..b9cd975 100644 --- a/tests/Feature/Auth/ResetPasswordTest.php +++ b/tests/Feature/Auth/ResetPasswordTest.php @@ -35,7 +35,6 @@ class ResetPasswordTest extends TestCase $user, 'Illuminate\Auth\Notifications\ResetPassword', function ($notification, $channels) use ($user) { - $userPasswordReset = \DB::table('password_resets') ->where('email', $user->email)->first(); diff --git a/tests/Feature/InstallationTest.php b/tests/Feature/InstallationTest.php index a66e50a..96939b6 100644 --- a/tests/Feature/InstallationTest.php +++ b/tests/Feature/InstallationTest.php @@ -6,7 +6,7 @@ use App\Entities\Users\User; use Tests\TestCase; /** - * Installation Feature Test + * Installation Feature Test. * * @author Nafies Luthfi */ diff --git a/tests/Feature/ManageJobsTest.php b/tests/Feature/ManageJobsTest.php index cdc5dc8..4f4f606 100644 --- a/tests/Feature/ManageJobsTest.php +++ b/tests/Feature/ManageJobsTest.php @@ -10,7 +10,7 @@ use App\Entities\Users\User; use Tests\TestCase; /** - * Manage Project Feature Test + * Manage Project Feature Test. * * @author Nafies Luthfi */ diff --git a/tests/Feature/ManageSubscriptionsTest.php b/tests/Feature/ManageSubscriptionsTest.php index b8ad28d..8c27e2e 100644 --- a/tests/Feature/ManageSubscriptionsTest.php +++ b/tests/Feature/ManageSubscriptionsTest.php @@ -21,28 +21,28 @@ class ManageSubscriptionsTest extends TestCase // Fill Form $this->submitForm(trans('subscription.create'), [ - 'name' => 'www.domain.com', - 'price' => 100000, + 'name' => 'www.domain.com', + 'price' => 100000, 'start_date' => '2015-05-02', - 'due_date' => '2016-05-02', + 'due_date' => '2016-05-02', 'project_id' => $project->id, - 'vendor_id' => $vendor->id, - 'type_id' => 1, - 'notes' => 'epp_code:EPPCODE', + 'vendor_id' => $vendor->id, + 'type_id' => 1, + 'notes' => 'epp_code:EPPCODE', ]); $this->see(trans('subscription.created')); $this->seePageIs(route('subscriptions.index')); $this->seeInDatabase('subscriptions', [ - 'name' => 'www.domain.com', - 'price' => 100000, + 'name' => 'www.domain.com', + 'price' => 100000, 'start_date' => '2015-05-02', - 'due_date' => '2016-05-02', + 'due_date' => '2016-05-02', 'project_id' => $project->id, - 'vendor_id' => $vendor->id, - 'type_id' => 1, - 'notes' => 'epp_code:EPPCODE', + 'vendor_id' => $vendor->id, + 'type_id' => 1, + 'notes' => 'epp_code:EPPCODE', ]); } @@ -60,12 +60,12 @@ class ManageSubscriptionsTest extends TestCase // Fill Form $this->submitForm(trans('subscription.update'), [ 'start_date' => '2015-05-02', - 'due_date' => '2016-05-02', + 'due_date' => '2016-05-02', 'project_id' => $project->id, - 'vendor_id' => $vendor->id, - 'type_id' => 1, - 'status_id' => 1, - 'notes' => 'epp_code:EPPCODE1', + 'vendor_id' => $vendor->id, + 'type_id' => 1, + 'status_id' => 1, + 'notes' => 'epp_code:EPPCODE1', ]); $this->seePageIs(route('subscriptions.edit', $subscription->id)); @@ -73,12 +73,12 @@ class ManageSubscriptionsTest extends TestCase $this->seeInDatabase('subscriptions', [ 'start_date' => '2015-05-02', - 'due_date' => '2016-05-02', + 'due_date' => '2016-05-02', 'project_id' => $project->id, - 'vendor_id' => $vendor->id, - 'type_id' => 1, - 'status_id' => 1, - 'notes' => 'epp_code:EPPCODE1', + 'vendor_id' => $vendor->id, + 'type_id' => 1, + 'status_id' => 1, + 'notes' => 'epp_code:EPPCODE1', ]); } diff --git a/tests/Feature/Partners/ManageCustomersTest.php b/tests/Feature/Partners/ManageCustomersTest.php index c66b097..0c86817 100644 --- a/tests/Feature/Partners/ManageCustomersTest.php +++ b/tests/Feature/Partners/ManageCustomersTest.php @@ -13,7 +13,7 @@ class ManageCustomersTest extends TestCase /** @test */ public function user_can_see_customer_list_in_customer_index_page() { - $user = $this->adminUserSigningIn(); + $user = $this->adminUserSigningIn(); $customer1 = factory(Customer::class)->create(); $customer2 = factory(Customer::class)->create(); @@ -57,7 +57,7 @@ class ManageCustomersTest extends TestCase /** @test */ public function user_can_edit_a_customer() { - $user = $this->adminUserSigningIn(); + $user = $this->adminUserSigningIn(); $customer = factory(Customer::class)->create(['name' => 'Testing 123']); $this->visit(route('customers.show', [$customer->id])); @@ -92,7 +92,7 @@ class ManageCustomersTest extends TestCase /** @test */ public function user_can_delete_a_customer() { - $user = $this->adminUserSigningIn(); + $user = $this->adminUserSigningIn(); $customer = factory(Customer::class)->create(); $this->visit(route('customers.edit', [$customer->id])); diff --git a/tests/Feature/Payments/ManagePaymentsTest.php b/tests/Feature/Payments/ManagePaymentsTest.php index 3d484bc..4fe6af5 100644 --- a/tests/Feature/Payments/ManagePaymentsTest.php +++ b/tests/Feature/Payments/ManagePaymentsTest.php @@ -9,7 +9,7 @@ use App\Entities\Projects\Project; use Tests\TestCase; /** - * Manage Payments Feature Test + * Manage Payments Feature Test. * * @author Nafies Luthfi */ diff --git a/tests/Feature/Payments/ManageProjectFeesTest.php b/tests/Feature/Payments/ManageProjectFeesTest.php index 2b43304..a41e5f8 100644 --- a/tests/Feature/Payments/ManageProjectFeesTest.php +++ b/tests/Feature/Payments/ManageProjectFeesTest.php @@ -43,5 +43,4 @@ class ManageProjectFeesTest extends TestCase 'partner_id' => $worker->id, ]); } - } diff --git a/tests/Feature/Projects/UploadFilesTest.php b/tests/Feature/Projects/UploadFilesTest.php index 96dde02..2da6d45 100644 --- a/tests/Feature/Projects/UploadFilesTest.php +++ b/tests/Feature/Projects/UploadFilesTest.php @@ -13,7 +13,7 @@ class UploadFilesTest extends TestCase public function user_can_upload_document_to_a_project() { Storage::fake('avatar'); - $user = $this->adminUserSigningIn(); + $user = $this->adminUserSigningIn(); $project = factory(Project::class)->create(); $this->visit(route('projects.files', $project->id)); $this->seeElement('form', ['id' => 'upload-file']); @@ -42,7 +42,7 @@ class UploadFilesTest extends TestCase public function user_can_edit_document_file_on_a_project() { Storage::fake('avatar'); - $user = $this->adminUserSigningIn(); + $user = $this->adminUserSigningIn(); $project = factory(Project::class)->create(); // $file = factory(File::class, 'project')->create(['fileable_id' => $project->id]); // dd(get_class_methods((new FileFactory)->create('123.txt'))); diff --git a/tests/Feature/Users/ManageUsersTest.php b/tests/Feature/Users/ManageUsersTest.php index e99b4c2..4936307 100644 --- a/tests/Feature/Users/ManageUsersTest.php +++ b/tests/Feature/Users/ManageUsersTest.php @@ -6,7 +6,7 @@ use App\Entities\Users\User; use Tests\TestCase; /** - * Manage Users Feature Test + * Manage Users Feature Test. * * @author Nafies Luthfi */ diff --git a/tests/Feature/Users/UserProfileTest.php b/tests/Feature/Users/UserProfileTest.php index 85e039a..3e346c6 100644 --- a/tests/Feature/Users/UserProfileTest.php +++ b/tests/Feature/Users/UserProfileTest.php @@ -5,7 +5,7 @@ namespace Tests\Feature\Users; use Tests\TestCase; /** - * User Profile Feature Test + * User Profile Feature Test. * * @author Nafies Luthfi */ diff --git a/tests/TestCase.php b/tests/TestCase.php index db0c3f2..def386d 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -40,6 +40,7 @@ abstract class TestCase extends BaseTestCase { $user = factory(User::class)->create(); $user->assignRole($role); + return $user; } diff --git a/tests/Unit/InvoiceDraftCollectionTest.php b/tests/Unit/InvoiceDraftCollectionTest.php index 6ed8f35..27a68aa 100644 --- a/tests/Unit/InvoiceDraftCollectionTest.php +++ b/tests/Unit/InvoiceDraftCollectionTest.php @@ -2,9 +2,9 @@ namespace Tests\Unit; -use App\Services\InvoiceDrafts\Item; use App\Services\InvoiceDrafts\InvoiceDraft; use App\Services\InvoiceDrafts\InvoiceDraftCollection; +use App\Services\InvoiceDrafts\Item; use Tests\TestCase; class InvoiceDraftCollectionTest extends TestCase diff --git a/tests/Unit/Models/CustomerTest.php b/tests/Unit/Models/CustomerTest.php index 1fa42c5..d189638 100644 --- a/tests/Unit/Models/CustomerTest.php +++ b/tests/Unit/Models/CustomerTest.php @@ -13,7 +13,7 @@ class CustomerTest extends TestCase public function a_customer_has_many_projects() { $customer = factory(Customer::class)->create(); - $project = factory(Project::class)->create(['customer_id' => $customer->id]); + $project = factory(Project::class)->create(['customer_id' => $customer->id]); $this->assertInstanceOf(Collection::class, $customer->projects); $this->assertInstanceOf(Project::class, $customer->projects->first()); diff --git a/tests/Unit/Models/UserTest.php b/tests/Unit/Models/UserTest.php index c9065a3..f44a52f 100644 --- a/tests/Unit/Models/UserTest.php +++ b/tests/Unit/Models/UserTest.php @@ -6,7 +6,7 @@ use App\Entities\Users\User; use Tests\TestCase; /** - * User Model Unit Test + * User Model Unit Test. * * @author Nafies Luthfi */ diff --git a/tests/Unit/Policies/CustomerPolicyTest.php b/tests/Unit/Policies/CustomerPolicyTest.php index e9e0ce1..115ebdd 100644 --- a/tests/Unit/Policies/CustomerPolicyTest.php +++ b/tests/Unit/Policies/CustomerPolicyTest.php @@ -11,13 +11,13 @@ class CustomerPolicyTest extends TestCase public function user_can_create_customer() { $user = $this->adminUserSigningIn(); - $this->assertTrue($user->can('create', new Customer)); + $this->assertTrue($user->can('create', new Customer())); } /** @test */ public function user_can_view_customer() { - $user = $this->adminUserSigningIn(); + $user = $this->adminUserSigningIn(); $customer = factory(Customer::class)->create(['name' => 'Customer 1 name']); $this->assertTrue($user->can('view', $customer)); } @@ -25,7 +25,7 @@ class CustomerPolicyTest extends TestCase /** @test */ public function user_can_update_customer() { - $user = $this->adminUserSigningIn(); + $user = $this->adminUserSigningIn(); $customer = factory(Customer::class)->create(['name' => 'Customer 1 name']); $this->assertTrue($user->can('update', $customer)); } @@ -33,7 +33,7 @@ class CustomerPolicyTest extends TestCase /** @test */ public function user_can_delete_customer() { - $user = $this->adminUserSigningIn(); + $user = $this->adminUserSigningIn(); $customer = factory(Customer::class)->create(['name' => 'Customer 1 name']); $this->assertTrue($user->can('delete', $customer)); } diff --git a/tests/Unit/Policies/ProjectPolicyTest.php b/tests/Unit/Policies/ProjectPolicyTest.php index eded227..023de85 100644 --- a/tests/Unit/Policies/ProjectPolicyTest.php +++ b/tests/Unit/Policies/ProjectPolicyTest.php @@ -12,13 +12,13 @@ class ProjectPolicyTest extends TestCase { $user = $this->userSigningIn(); - $this->assertTrue($user->can('create', new Project)); + $this->assertTrue($user->can('create', new Project())); } /** @test */ public function user_can_view_project() { - $user = $this->userSigningIn(); + $user = $this->userSigningIn(); $project = factory(Project::class)->create(); $this->assertTrue($user->can('view', $project)); @@ -27,7 +27,7 @@ class ProjectPolicyTest extends TestCase /** @test */ public function user_can_update_project() { - $user = $this->userSigningIn(); + $user = $this->userSigningIn(); $project = factory(Project::class)->create(); $this->assertTrue($user->can('update', $project)); @@ -36,7 +36,7 @@ class ProjectPolicyTest extends TestCase /** @test */ public function user_can_delete_project() { - $user = $this->userSigningIn(); + $user = $this->userSigningIn(); $project = factory(Project::class)->create(); $this->assertTrue($user->can('delete', $project)); diff --git a/tests/Unit/Policies/UserPolicyTest.php b/tests/Unit/Policies/UserPolicyTest.php index b0a0d42..430a987 100644 --- a/tests/Unit/Policies/UserPolicyTest.php +++ b/tests/Unit/Policies/UserPolicyTest.php @@ -15,14 +15,14 @@ class UserPolicyTest extends TestCase { $admin = $this->adminUserSigningIn(); - $this->assertTrue($admin->can('create', new User)); + $this->assertTrue($admin->can('create', new User())); } /** @test */ public function admin_can_view_user() { $admin = $this->adminUserSigningIn(); - $user = factory(User::class)->create(); + $user = factory(User::class)->create(); $this->assertTrue($admin->can('view', $user)); } @@ -31,7 +31,7 @@ class UserPolicyTest extends TestCase public function admin_can_update_user() { $admin = $this->adminUserSigningIn(); - $user = factory(User::class)->create(); + $user = factory(User::class)->create(); $this->assertTrue($admin->can('update', $user)); } @@ -40,7 +40,7 @@ class UserPolicyTest extends TestCase public function admin_can_delete_user() { $admin = $this->adminUserSigningIn(); - $user = factory(User::class)->create(); + $user = factory(User::class)->create(); $this->assertTrue($admin->can('delete', $user)); } diff --git a/tests/Unit/Policies/VendorPolicyTest.php b/tests/Unit/Policies/VendorPolicyTest.php index 2b3ff84..e8afae7 100644 --- a/tests/Unit/Policies/VendorPolicyTest.php +++ b/tests/Unit/Policies/VendorPolicyTest.php @@ -14,13 +14,13 @@ class VendorPolicyTest extends TestCase public function user_can_create_vendor() { $user = $this->adminUserSigningIn(); - $this->assertTrue($user->can('create', new Vendor)); + $this->assertTrue($user->can('create', new Vendor())); } /** @test */ public function user_can_view_vendor() { - $user = $this->adminUserSigningIn(); + $user = $this->adminUserSigningIn(); $vendor = factory(Vendor::class)->create(); $this->assertTrue($user->can('view', $vendor)); } @@ -28,7 +28,7 @@ class VendorPolicyTest extends TestCase /** @test */ public function user_can_update_vendor() { - $user = $this->adminUserSigningIn(); + $user = $this->adminUserSigningIn(); $vendor = factory(Vendor::class)->create(); $this->assertTrue($user->can('update', $vendor)); } @@ -36,7 +36,7 @@ class VendorPolicyTest extends TestCase /** @test */ public function user_can_delete_vendor() { - $user = $this->adminUserSigningIn(); + $user = $this->adminUserSigningIn(); $vendor = factory(Vendor::class)->create(); $this->assertTrue($user->can('delete', $vendor)); } diff --git a/tests/Unit/Queries/AdminDashboardQueryTest.php b/tests/Unit/Queries/AdminDashboardQueryTest.php index c912e3f..cf9a4fc 100644 --- a/tests/Unit/Queries/AdminDashboardQueryTest.php +++ b/tests/Unit/Queries/AdminDashboardQueryTest.php @@ -21,8 +21,8 @@ class AdminDashboardQueryTest extends TestCase factory(Payment::class, 2)->create(['in_out' => 0, 'amount' => 200, 'date' => '2015-09-04']); factory(Payment::class)->create(['in_out' => 1, 'amount' => 500, 'date' => '2016-01-04']); - $this->assertEquals(2100, (new AdminDashboardQuery)->totalEarnings('2015')); - $this->assertEquals(500, (new AdminDashboardQuery)->totalEarnings('2016')); + $this->assertEquals(2100, (new AdminDashboardQuery())->totalEarnings('2015')); + $this->assertEquals(500, (new AdminDashboardQuery())->totalEarnings('2016')); } /** @test */ @@ -33,8 +33,8 @@ class AdminDashboardQueryTest extends TestCase factory(Project::class, 2)->create(['status_id' => 5, 'start_date' => '2015-09-04']); factory(Project::class)->create(['status_id' => 4, 'start_date' => '2016-01-04']); - $this->assertEquals(3, (new AdminDashboardQuery)->totalFinishedProjects('2015')); - $this->assertEquals(1, (new AdminDashboardQuery)->totalFinishedProjects('2016')); + $this->assertEquals(3, (new AdminDashboardQuery())->totalFinishedProjects('2015')); + $this->assertEquals(1, (new AdminDashboardQuery())->totalFinishedProjects('2016')); } /** @test */ @@ -52,8 +52,8 @@ class AdminDashboardQueryTest extends TestCase $project = factory(Project::class)->create(['project_value' => 2000, 'status_id' => 3, 'start_date' => '2016-01-04']); factory(Payment::class)->create(['project_id' => $project->id, 'amount' => 1000]); - $this->assertEquals(2000, (new AdminDashboardQuery)->currentOutstandingCustomerPayment('2015')); - $this->assertEquals(1000, (new AdminDashboardQuery)->currentOutstandingCustomerPayment('2016')); + $this->assertEquals(2000, (new AdminDashboardQuery())->currentOutstandingCustomerPayment('2015')); + $this->assertEquals(1000, (new AdminDashboardQuery())->currentOutstandingCustomerPayment('2016')); } /** @test */ @@ -66,7 +66,7 @@ class AdminDashboardQueryTest extends TestCase factory(Subscription::class)->create(['due_date' => $dueDate, 'status_id' => 0]); factory(Subscription::class)->create(['due_date' => Carbon::now()->addMonths(3)->format('Y-m-d')]); - $this->assertCount(2, (new AdminDashboardQuery)->upcomingSubscriptionDueDatesList()); + $this->assertCount(2, (new AdminDashboardQuery())->upcomingSubscriptionDueDatesList()); } /** @test */ @@ -93,6 +93,6 @@ class AdminDashboardQueryTest extends TestCase $this->assertCount(2, Project::all()); $this->assertCount(4, Job::all()); $this->assertCount(8, Task::all()); - $this->assertEquals(3, (new AdminDashboardQuery)->onProgressJobCount()); + $this->assertEquals(3, (new AdminDashboardQuery())->onProgressJobCount()); } } diff --git a/tests/Unit/References/PaymentTypeTest.php b/tests/Unit/References/PaymentTypeTest.php index 49a4082..ad7d285 100644 --- a/tests/Unit/References/PaymentTypeTest.php +++ b/tests/Unit/References/PaymentTypeTest.php @@ -10,7 +10,7 @@ class PaymentTypeTest extends TestCase /** @test */ public function retrieve_payment_type_list() { - $paymentType = new Type; + $paymentType = new Type(); $this->assertEquals([ 1 => trans('payment.types.project'), @@ -22,7 +22,7 @@ class PaymentTypeTest extends TestCase /** @test */ public function retrieve_payment_type_name_by_id() { - $paymentType = new Type; + $paymentType = new Type(); $this->assertEquals(trans('payment.types.project'), $paymentType->getNameById(1)); $this->assertEquals(trans('payment.types.add_job'), $paymentType->getNameById(2)); @@ -32,7 +32,7 @@ class PaymentTypeTest extends TestCase /** @test */ public function retrieve_payment_type_color_class_by_id() { - $paymentType = new Type; + $paymentType = new Type(); $this->assertEquals('#337ab7', $paymentType->getColorById(1)); $this->assertEquals('#4caf50', $paymentType->getColorById(2)); diff --git a/tests/Unit/References/ProjectStatusTest.php b/tests/Unit/References/ProjectStatusTest.php index 1a40337..6e287c6 100644 --- a/tests/Unit/References/ProjectStatusTest.php +++ b/tests/Unit/References/ProjectStatusTest.php @@ -10,7 +10,7 @@ class ProjectStatusTest extends TestCase /** @test */ public function retrieve_project_status_list() { - $projectStatus = new Status; + $projectStatus = new Status(); $this->assertEquals([ 1 => trans('project.planned'), @@ -25,7 +25,7 @@ class ProjectStatusTest extends TestCase /** @test */ public function retrieve_project_status_name_by_id() { - $projectStatus = new Status; + $projectStatus = new Status(); $this->assertEquals(trans('project.planned'), $projectStatus->getNameById(1)); $this->assertEquals(trans('project.progress'), $projectStatus->getNameById(2)); @@ -38,7 +38,7 @@ class ProjectStatusTest extends TestCase /** @test */ public function retrieve_project_status_icon_by_id() { - $projectStatus = new Status; + $projectStatus = new Status(); $this->assertEquals('paperclip', $projectStatus->getIconById(1)); $this->assertEquals('tasks', $projectStatus->getIconById(2)); @@ -51,7 +51,7 @@ class ProjectStatusTest extends TestCase /** @test */ public function retrieve_project_status_color_class_by_id() { - $projectStatus = new Status; + $projectStatus = new Status(); $this->assertEquals('default', $projectStatus->getColorById(1)); $this->assertEquals('yellow', $projectStatus->getColorById(2)); diff --git a/tests/Unit/References/SubscriptionTypeTest.php b/tests/Unit/References/SubscriptionTypeTest.php index 296588a..738111c 100644 --- a/tests/Unit/References/SubscriptionTypeTest.php +++ b/tests/Unit/References/SubscriptionTypeTest.php @@ -10,7 +10,7 @@ class SubscriptionTypeTest extends TestCase /** @test */ public function retrieve_subscription_type_list() { - $subscriptionType = new Type; + $subscriptionType = new Type(); $this->assertEquals([ 1 => trans('subscription.types.domain'), @@ -22,7 +22,7 @@ class SubscriptionTypeTest extends TestCase /** @test */ public function retrieve_subscription_type_name_by_id() { - $subscriptionType = new Type; + $subscriptionType = new Type(); $this->assertEquals(trans('subscription.types.domain'), $subscriptionType->getNameById(1)); $this->assertEquals(trans('subscription.types.hosting'), $subscriptionType->getNameById(2)); @@ -32,7 +32,7 @@ class SubscriptionTypeTest extends TestCase /** @test */ public function retrieve_subscription_type_color_class_by_id() { - $subscriptionType = new Type; + $subscriptionType = new Type(); $this->assertEquals('#337ab7', $subscriptionType->getColorById(1)); $this->assertEquals('#4caf50', $subscriptionType->getColorById(2));