From a62859dc6d0086f5a6fafb9d827280d435a1ad90 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 7 Apr 2016 13:21:09 -0700 Subject: [PATCH] Updated docblocks --- .../Controllers/AccessoriesController.php | 14 +- .../AssetMaintenancesController.php | 15 +- .../Controllers/AssetModelsController.php | 14 +- app/Http/Controllers/AssetsController.php | 15 +- app/Http/Controllers/Auth/AuthController.php | 18 ++- .../Controllers/Auth/PasswordController.php | 8 ++ app/Http/Controllers/CategoriesController.php | 15 +- app/Http/Controllers/CompaniesController.php | 17 ++- app/Http/Controllers/ComponentsController.php | 16 +-- .../Controllers/ConsumablesController.php | 17 ++- app/Http/Controllers/Controller.php | 21 ++- .../Controllers/CustomFieldsController.php | 130 ++++++++++++------ app/Http/Controllers/DashboardController.php | 25 ++-- .../Controllers/DepreciationsController.php | 97 ++++++++----- app/Http/Controllers/GroupsController.php | 97 ++++++++----- app/Http/Controllers/LicensesController.php | 15 +- app/Http/Controllers/LocationsController.php | 18 +-- .../Controllers/ManufacturersController.php | 14 +- app/Http/Controllers/ProfileController.php | 15 +- app/Http/Controllers/ReportsController.php | 15 +- app/Http/Controllers/SettingsController.php | 14 +- .../Controllers/StatuslabelsController.php | 15 +- app/Http/Controllers/SuppliersController.php | 15 +- app/Http/Controllers/UsersController.php | 14 +- app/Http/Controllers/ViewAssetsController.php | 16 +-- app/Models/Accessory.php | 7 +- app/Models/Actionlog.php | 6 + app/Models/Asset.php | 6 +- app/Models/AssetMaintenance.php | 7 +- app/Models/AssetModel.php | 6 + app/Models/Category.php | 10 +- app/Models/Company.php | 7 +- app/Models/CompanyableChildScope.php | 6 + app/Models/CompanyableScope.php | 6 + app/Models/Component.php | 7 +- app/Providers/AppServiceProvider.php | 15 +- 36 files changed, 435 insertions(+), 318 deletions(-) diff --git a/app/Http/Controllers/AccessoriesController.php b/app/Http/Controllers/AccessoriesController.php index 83f02a8d1a..1e3102b5f2 100755 --- a/app/Http/Controllers/AccessoriesController.php +++ b/app/Http/Controllers/AccessoriesController.php @@ -1,13 +1,4 @@ ] */ class AssetModelsController extends Controller { diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.php index 95b1a0239e..fc8b66ff1f 100755 --- a/app/Http/Controllers/AssetsController.php +++ b/app/Http/Controllers/AssetsController.php @@ -1,13 +1,4 @@ ] */ class AssetsController extends Controller { diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index b7db169766..2efcfdac32 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -15,18 +15,16 @@ use Redirect; use Log; use View; +/** + * This controller handles authentication for the user, including local + * database users and LDAP users. + * + * @todo Move LDAP methods into user model for better separation of concerns. + * @author [A. Gianotto] [] + * @version v1.0 + */ class AuthController extends Controller { - /* - |-------------------------------------------------------------------------- - | Registration & Login Controller - |-------------------------------------------------------------------------- - | - | This controller handles the registration of new users, as well as the - | authentication of existing users. By default, this controller uses - | a simple trait to add these behaviors. Why don't you explore it? - | - */ use ThrottlesLogins; diff --git a/app/Http/Controllers/Auth/PasswordController.php b/app/Http/Controllers/Auth/PasswordController.php index 1ceed97bba..6f3636d0b5 100644 --- a/app/Http/Controllers/Auth/PasswordController.php +++ b/app/Http/Controllers/Auth/PasswordController.php @@ -5,6 +5,14 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\ResetsPasswords; +/** + * This controller handles password resets for the user. + * It uses the built-in Laravel magic of ResetsPasswords, so we + * don't actually do much here. + * + * @author [A. Gianotto] [] + * @version v1.0 + */ class PasswordController extends Controller { /* diff --git a/app/Http/Controllers/CategoriesController.php b/app/Http/Controllers/CategoriesController.php index 48bfd1fc10..32cff09014 100755 --- a/app/Http/Controllers/CategoriesController.php +++ b/app/Http/Controllers/CategoriesController.php @@ -1,12 +1,4 @@ ] + */ class CategoriesController extends Controller { diff --git a/app/Http/Controllers/CompaniesController.php b/app/Http/Controllers/CompaniesController.php index 1c2eedf33f..6bb02f3dc0 100644 --- a/app/Http/Controllers/CompaniesController.php +++ b/app/Http/Controllers/CompaniesController.php @@ -1,13 +1,5 @@ ] + */ + class CustomFieldsController extends Controller { /** - * Display a listing of the resource. - * - * @return Response - */ + * Returns a view with a listing of custom fields. + * + * @author [Brady Wetherington] [] + * @since [v1.8] + * @return View + */ public function index() { // @@ -39,10 +43,12 @@ class CustomFieldsController extends Controller /** - * Show the form for creating a new resource. - * - * @return Response - */ + * Returns a view with a form for creating a new custom fieldset. + * + * @author [Brady Wetherington] [] + * @since [v1.8] + * @return View + */ public function create() { // @@ -51,10 +57,12 @@ class CustomFieldsController extends Controller /** - * Store a newly created resource in storage. - * - * @return Response - */ + * Validates and stores a new custom fieldset. + * + * @author [Brady Wetherington] [] + * @since [v1.8] + * @return Redirect + */ public function store() { // @@ -68,6 +76,13 @@ class CustomFieldsController extends Controller } } + /** + * Associate the custom field with a custom fieldset. + * + * @author [Brady Wetherington] [] + * @since [v1.8] + * @return View + */ public function associate($id) { @@ -84,11 +99,29 @@ class CustomFieldsController extends Controller return Redirect::route("admin.custom_fields.show", [$id])->with("success", Lang::get('admin/custom_fields/message.field.create.assoc_success')); } + + /** + * Returns a view with a form to create a new custom field. + * + * @see CustomFieldsController::storeField() + * @author [Brady Wetherington] [] + * @since [v1.8] + * @return View + */ public function createField() { return View::make("custom_fields.create_field"); } + + /** + * Validates and stores a new custom field. + * + * @see CustomFieldsController::createField() + * @author [Brady Wetherington] [] + * @since [v1.8] + * @return Redirect + */ public function storeField() { $field=new CustomField(["name" => Input::get("name"),"element" => Input::get("element"),"user_id" => Auth::user()->id]); @@ -114,6 +147,13 @@ class CustomFieldsController extends Controller } } + /** + * Delete a custom field. + * + * @author [Brady Wetherington] [] + * @since [v1.8] + * @return Redirect + */ public function deleteField($field_id) { $field=CustomField::find($field_id); @@ -127,11 +167,13 @@ class CustomFieldsController extends Controller } /** - * Display the specified resource. - * - * @param int $id - * @return Response - */ + * Validates and stores a new custom field. + * + * @author [Brady Wetherington] [] + * @param int $id + * @since [v1.8] + * @return View + */ public function show($id) { //$id=$parameters[0]; @@ -158,11 +200,14 @@ class CustomFieldsController extends Controller /** - * Show the form for editing the specified resource. - * - * @param int $id - * @return Response - */ + * What the actual fuck, Brady? + * + * @todo Uhh, build this? + * @author [Brady Wetherington] [] + * @param int $id + * @since [v1.8] + * @return Fuckall + */ public function edit($id) { // @@ -170,11 +215,14 @@ class CustomFieldsController extends Controller /** - * Update the specified resource in storage. - * - * @param int $id - * @return Response - */ + * GET IN THE SEA BRADY. + * + * @todo Uhh, build this too? + * @author [Brady Wetherington] [] + * @param int $id + * @since [v1.8] + * @return Fuckall + */ public function update($id) { // @@ -182,11 +230,13 @@ class CustomFieldsController extends Controller /** - * Remove the specified resource from storage. - * - * @param int $id - * @return Response - */ + * Validates a custom fieldset and then deletes if it has no models associated. + * + * @author [Brady Wetherington] [] + * @param int $id + * @since [v1.8] + * @return View + */ public function destroy($id) { // diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index 2f35446791..342a1b9fb3 100755 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -1,12 +1,4 @@ ] + * @since [v1.0] + * @return View + */ public function getIndex() { // Show the page diff --git a/app/Http/Controllers/DepreciationsController.php b/app/Http/Controllers/DepreciationsController.php index 57e5d4733c..2feb9c29e7 100755 --- a/app/Http/Controllers/DepreciationsController.php +++ b/app/Http/Controllers/DepreciationsController.php @@ -1,12 +1,4 @@ ] + * @param string $status + * @since [v1.2] + * @return String JSON + */ public function getDatatable() { $depreciations = Depreciation::select(array('id','name','months')); diff --git a/app/Http/Controllers/GroupsController.php b/app/Http/Controllers/GroupsController.php index f6c797aabb..e559aaac75 100755 --- a/app/Http/Controllers/GroupsController.php +++ b/app/Http/Controllers/GroupsController.php @@ -1,12 +1,4 @@ ] + * @since [v2.0] + * @return String JSON + */ + public function getDatatable() { if (Input::has('offset')) { diff --git a/app/Http/Controllers/LicensesController.php b/app/Http/Controllers/LicensesController.php index 1620bc4aec..39908f0c76 100755 --- a/app/Http/Controllers/LicensesController.php +++ b/app/Http/Controllers/LicensesController.php @@ -1,13 +1,4 @@ where(function ($query) use ($search) { - + foreach ($search as $search) { $query->whereHas('category', function ($query) use ($search) { $query->where('categories.name', 'LIKE', '%'.$search.'%'); diff --git a/app/Models/Actionlog.php b/app/Models/Actionlog.php index 755ab24615..6e77ae3ac0 100755 --- a/app/Models/Actionlog.php +++ b/app/Models/Actionlog.php @@ -6,6 +6,12 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Database\Eloquent\SoftDeletes; +/** + * Model for the Actionlog (the table that keeps a historical log of + * checkouts, checkins, and updates). + * + * @version v1.0 + */ class Actionlog extends Model implements ICompanyableChild { use SoftDeletes; diff --git a/app/Models/Asset.php b/app/Models/Asset.php index aef0df8b85..01758c4d27 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -13,7 +13,11 @@ use Watson\Validating\ValidatingTrait; use DateTime; use App\Models\Setting; - +/** + * Model for Assets. + * + * @version v1.0 + */ class Asset extends Depreciable { use SoftDeletes; diff --git a/app/Models/AssetMaintenance.php b/app/Models/AssetMaintenance.php index 065a7c265d..e15f2f8f26 100644 --- a/app/Models/AssetMaintenance.php +++ b/app/Models/AssetMaintenance.php @@ -6,6 +6,11 @@ use Illuminate\Support\Facades\Lang; use Illuminate\Database\Eloquent\SoftDeletes; use Watson\Validating\ValidatingTrait; +/** + * Model for Asset Maintenances. + * + * @version v1.0 + */ class AssetMaintenance extends Model implements ICompanyableChild { use SoftDeletes; @@ -104,7 +109,7 @@ class AssetMaintenance extends Model implements ICompanyableChild { return $query->where(function ($query) use ($search) { - + $query->where('title', 'LIKE', '%'.$search.'%') ->orWhere('notes', 'LIKE', '%'.$search.'%') ->orWhere('asset_maintenance_type', 'LIKE', '%'.$search.'%') diff --git a/app/Models/AssetModel.php b/app/Models/AssetModel.php index 549326e143..6aa1c24dfe 100755 --- a/app/Models/AssetModel.php +++ b/app/Models/AssetModel.php @@ -5,6 +5,12 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Watson\Validating\ValidatingTrait; +/** + * Model for Asset Models. Asset Models contain higher level + * attributes that are common among the same type of asset. + * + * @version v1.0 + */ class AssetModel extends Model { use SoftDeletes; diff --git a/app/Models/Category.php b/app/Models/Category.php index aac697635e..a811bec4c8 100755 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -5,6 +5,14 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Watson\Validating\ValidatingTrait; +/** + * Model for Categories. Categories are a higher-level group + * than Asset Models, and handle things like whether or not + * to require acceptance from the user, whether or not to + * send a EULA to the user, etc. + * + * @version v1.0 + */ class Category extends Model { @@ -127,7 +135,7 @@ class Category extends Model { return $query->where(function ($query) use ($search) { - + $query->where('name', 'LIKE', '%'.$search.'%') ->orWhere('category_type', 'LIKE', '%'.$search.'%'); }); diff --git a/app/Models/Company.php b/app/Models/Company.php index 8c1e72da1b..17d26ade91 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -4,6 +4,11 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; use Watson\Validating\ValidatingTrait; +/** + * Model for Companies. + * + * @version v1.8 + */ final class Company extends Model { protected $table = 'companies'; @@ -139,7 +144,7 @@ final class Company extends Model return $query; } else { $f = function ($q) { - + static::scopeCompanyablesDirectly($q); }; diff --git a/app/Models/CompanyableChildScope.php b/app/Models/CompanyableChildScope.php index 6817d2f521..e569522b19 100644 --- a/app/Models/CompanyableChildScope.php +++ b/app/Models/CompanyableChildScope.php @@ -5,6 +5,12 @@ use Illuminate\Database\Eloquent\Model; use \Illuminate\Database\Eloquent\Builder; use \Illuminate\Database\Eloquent\Scope; +/** + * Handle query scoping for full company support. + * + * @todo Move this to a more Laravel 5.2 esque way + * @version v1.0 + */ final class CompanyableChildScope implements Scope { /** diff --git a/app/Models/CompanyableScope.php b/app/Models/CompanyableScope.php index c0e52f284f..e99d934b51 100644 --- a/app/Models/CompanyableScope.php +++ b/app/Models/CompanyableScope.php @@ -5,6 +5,12 @@ use Illuminate\Database\Eloquent\Model; use \Illuminate\Database\Eloquent\Builder; use \Illuminate\Database\Eloquent\Scope; +/** + * Handle query scoping for full company support. + * + * @todo Move this to a more Laravel 5.2 esque way + * @version v1.0 + */ final class CompanyableScope implements Scope { /** diff --git a/app/Models/Component.php b/app/Models/Component.php index e7e98ddc9b..8b3e3395dc 100644 --- a/app/Models/Component.php +++ b/app/Models/Component.php @@ -11,6 +11,11 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Watson\Validating\ValidatingTrait; +/** + * Model for Components. + * + * @version v1.0 + */ class Component extends Model { use SoftDeletes; @@ -116,7 +121,7 @@ class Component extends Model $search = explode(' ', $search); return $query->where(function ($query) use ($search) { - + foreach ($search as $search) { $query->whereHas('category', function ($query) use ($search) { $query->where('categories.name', 'LIKE', '%'.$search.'%'); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index d7579fb0c2..99a492ba85 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -1,17 +1,16 @@