Skip to content

A free open source IT asset/license management system

Updated docblocks

snipea62859dc6d00
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 @@
<?php
-/**
- * This controller handles all actions related to Accessories for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
-
namespace App\Http\Controllers;
use App\Helpers\Helper;
@@ -29,7 +20,10 @@ use Auth;
use Request;
/**
- * This class controls all actions related to accessories
+ * This controller handles all actions related to Accessories for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
*/
class AccessoriesController extends Controller
{
diff --git a/app/Http/Controllers/AssetMaintenancesController.php b/app/Http/Controllers/AssetMaintenancesController.php
index e3d76fa6fd..d8b5c752e2 100644
--- a/app/Http/Controllers/AssetMaintenancesController.php
+++ b/app/Http/Controllers/AssetMaintenancesController.php
@@ -1,13 +1,4 @@
<?php
-/**
- * This controller handles all actions related to Asset Maintenance for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v2.0
- */
-
namespace App\Http\Controllers;
use App\Models\AssetMaintenance;
@@ -30,6 +21,12 @@ use App\Models\Setting;
use App\Models\Asset;
use App\Helpers\Helper;
+/**
+ * This controller handles all actions related to Asset Maintenance for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v2.0
+ */
class AssetMaintenancesController extends Controller
{
diff --git a/app/Http/Controllers/AssetModelsController.php b/app/Http/Controllers/AssetModelsController.php
index 772921bd7f..7b7d9a331b 100755
--- a/app/Http/Controllers/AssetModelsController.php
+++ b/app/Http/Controllers/AssetModelsController.php
@@ -1,12 +1,4 @@
<?php
-/**
- * This controller handles all actions related to Asset Models for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
namespace App\Http\Controllers;
use Image;
@@ -30,7 +22,11 @@ use App\Helpers\Helper;
use Symfony\Component\HttpFoundation\JsonResponse;
/**
- * This class controls all actions related to asset models
+ * This class controls all actions related to asset models for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ * @author [A. Gianotto] [<[email protected]>]
*/
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 @@
<?php
-/**
- * This controller handles all actions related to Assets for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
-
namespace App\Http\Controllers;
use App\Helpers\Helper;
@@ -50,7 +41,11 @@ use TCPDF;
use View;
/**
- * This class controls all actions related to assets
+ * This class controls all actions related to assets for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ * @author [A. Gianotto] [<[email protected]>]
*/
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] [<[email protected]>]
+ * @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] [<[email protected]>]
+ * @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 @@
<?php
-/**
- * This controller handles all actions related to Asset Categories for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
namespace App\Http\Controllers;
use App\Helpers\Helper;
@@ -21,6 +13,13 @@ use Redirect;
use Str;
use View;
+/**
+ * This class controls all actions related to Categories for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ * @author [A. Gianotto] [<[email protected]>]
+ */
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 @@
<?php
-/**
- * This controller handles all actions related to Company support for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v2.0
- */
- namespace App\Http\Controllers;
+namespace App\Http\Controllers;
use App\Models\Company;
use Input;
@@ -15,6 +7,13 @@ use Lang;
use Redirect;
use View;
+/**
+ * This controller handles all actions related to Companies for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
+
final class CompaniesController extends Controller
{
diff --git a/app/Http/Controllers/ComponentsController.php b/app/Http/Controllers/ComponentsController.php
index 852a76dec0..c6525ce5ec 100644
--- a/app/Http/Controllers/ComponentsController.php
+++ b/app/Http/Controllers/ComponentsController.php
@@ -1,13 +1,5 @@
<?php
-/**
- * This controller handles all actions related to Components for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v3.0
- */
- namespace App\Http\Controllers;
+namespace App\Http\Controllers;
use App\Helpers\Helper;
use App\Models\Actionlog;
@@ -28,6 +20,12 @@ use Slack;
use Str;
use View;
+/**
+ * This class controls all actions related to Components for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
class ComponentsController extends Controller
{
/**
diff --git a/app/Http/Controllers/ConsumablesController.php b/app/Http/Controllers/ConsumablesController.php
index 365cb3d073..efd3647c29 100644
--- a/app/Http/Controllers/ConsumablesController.php
+++ b/app/Http/Controllers/ConsumablesController.php
@@ -1,13 +1,6 @@
<?php
-/**
- * This controller handles all actions related to Consumables for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.8
- */
- namespace App\Http\Controllers;
+
+namespace App\Http\Controllers;
use App\Helpers\Helper;
use App\Models\Actionlog;
@@ -26,6 +19,12 @@ use Slack;
use Str;
use View;
+/**
+ * This controller handles all actions related to Consumables for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
class ConsumablesController extends Controller
{
/**
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index a77e425121..496e8f50fb 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -1,5 +1,24 @@
<?php
-
+/*! \mainpage Snipe-IT Code Documentation
+ *
+ * \section intro_sec Introduction
+ *
+ * This documentation is designed to allow developers to easily understand
+ * the backend code of Snipe-IT. Familiarity with the PHP language is assumed,
+ * and experience with the Laravel framework (version 5.2) will be very helpful.
+ *
+ * **THIS DOCUMENTATION DOES NOT COVER INSTALLATION.** If you're here and you're not a
+ * developer, you're probably in the wrong place. Please see the
+ * [Installation documentation](http://docs.snipeitapp.com) for
+ * information on how to install Snipe-IT.
+ *
+ * To learn how to set up a development environment and get started developing for Snipe-IT,
+ * please see the [contributing documentation](http://docs.snipeitapp.com/contributing.html).
+ *
+ * Only the Snipe-IT specific controllers, models, helpers, service providers,
+ * etc have been included in this documentation (excluding vendors, Laravel core, etc)
+ * for simplicity.
+ */
namespace App\Http\Controllers;
use Auth;
diff --git a/app/Http/Controllers/CustomFieldsController.php b/app/Http/Controllers/CustomFieldsController.php
index a34e1d8c99..6a8624d16b 100644
--- a/app/Http/Controllers/CustomFieldsController.php
+++ b/app/Http/Controllers/CustomFieldsController.php
@@ -1,12 +1,4 @@
<?php
-/**
- * This controller handles all actions related to Custom Asset Fields for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v2.0
- */
namespace App\Http\Controllers;
use View;
@@ -19,14 +11,26 @@ use App\Models\AssetModel;
use Lang;
use Auth;
+/**
+ * This controller handles all actions related to Custom Asset Fields for
+ * the Snipe-IT Asset Management application.
+ *
+ * @todo Improve documentation here.
+ * @todo Check for raw DB queries and try to convert them to query builder statements
+ * @version v2.0
+ * @author [Brady Wetherington] [<[email protected]>]
+ */
+
class CustomFieldsController extends Controller
{
/**
- * Display a listing of the resource.
- *
- * @return Response
- */
+ * Returns a view with a listing of custom fields.
+ *
+ * @author [Brady Wetherington] [<[email protected]>]
+ * @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] [<[email protected]>]
+ * @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] [<[email protected]>]
+ * @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] [<[email protected]>]
+ * @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] [<[email protected]>]
+ * @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] [<[email protected]>]
+ * @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] [<[email protected]>]
+ * @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] [<[email protected]>]
+ * @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] [<[email protected]>]
+ * @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] [<[email protected]>]
+ * @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] [<[email protected]>]
+ * @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 @@
<?php
-/**
- * This controller handles all actions related to the admin dashboard
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
namespace App\Http\Controllers;
use App\Http\Controllers\AdminController;
@@ -17,13 +9,22 @@ use Redirect;
use App\Models\Asset;
use App\Models\Company;
+/**
+ * This controller handles all actions related to the Admin Dashboard
+ * for the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
class DashboardController extends Controller
{
/**
- * Show the administration dashboard page.
- *
- * @return View
- */
+ * Check authorization and display admin dashboard, otherwise display
+ * the user's checked-out assets.
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @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 @@
<?php
-/**
- * This controller handles all actions related to Asset Depreciation
- * for the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
namespace App\Http\Controllers;
use Input;
@@ -19,14 +11,23 @@ use Str;
use View;
use Auth;
+/**
+ * This controller handles all actions related to Depreciations for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
class DepreciationsController extends Controller
{
/**
- * Show a list of all the depreciations.
- *
- * @return View
- */
-
+ * Returns a view that invokes the ajax tables which actually contains
+ * the content for the depreciation listing, which is generated in getDatatable.
+ *
+ * @author [A. Gianotto] [<[email protected]]
+ * @see DepreciationsController::getDatatable() method that generates the JSON response
+ * @since [v1.0]
+ * @return View
+ */
public function getIndex()
{
// Show the page
@@ -35,10 +36,13 @@ class DepreciationsController extends Controller
/**
- * Depreciation create.
- *
- * @return View
- */
+ * Returns a view that displays a form to create a new depreciation.
+ *
+ * @author [A. Gianotto] [<[email protected]]
+ * @see DepreciationsController::postCreate()
+ * @since [v1.0]
+ * @return View
+ */
public function getCreate()
{
// Show the page
@@ -48,10 +52,13 @@ class DepreciationsController extends Controller
/**
- * Depreciation create form processing.
- *
- * @return Redirect
- */
+ * Validates and stores the new depreciation data.
+ *
+ * @author [A. Gianotto] [<[email protected]]
+ * @see DepreciationsController::postCreate()
+ * @since [v1.0]
+ * @return Redirect
+ */
public function postCreate()
{
@@ -77,11 +84,14 @@ class DepreciationsController extends Controller
}
/**
- * Depreciation update.
- *
- * @param int $depreciationId
- * @return View
- */
+ * Returns a view that displays a form to update a depreciation.
+ *
+ * @author [A. Gianotto] [<[email protected]]
+ * @see DepreciationsController::postEdit()
+ * @param int $depreciationId
+ * @since [v1.0]
+ * @return View
+ */
public function getEdit($depreciationId = null)
{
// Check if the depreciation exists
@@ -99,11 +109,14 @@ class DepreciationsController extends Controller
/**
- * Depreciation update form processing page.
- *
- * @param int $depreciationId
- * @return Redirect
- */
+ * Validates and stores the updated depreciation data.
+ *
+ * @author [A. Gianotto] [<[email protected]]
+ * @see DepreciationsController::getEdit()
+ * @param int $depreciationId
+ * @since [v1.0]
+ * @return Redirect
+ */
public function postEdit($depreciationId = null)
{
// Check if the depreciation exists
@@ -128,11 +141,14 @@ class DepreciationsController extends Controller
}
/**
- * Delete the given depreciation.
- *
- * @param int $depreciationId
- * @return Redirect
- */
+ * Validates and deletes a selected depreciation.
+ *
+ * This is a hard-delete. We do not currently soft-delete depreciations.
+ *
+ * @author [A. Gianotto] [<[email protected]]
+ * @since [v1.0]
+ * @return Redirect
+ */
public function getDelete($depreciationId)
{
// Check if the depreciation exists
@@ -156,6 +172,15 @@ class DepreciationsController extends Controller
}
+ /**
+ * Generates the JSON used to display the depreciation listing.
+ *
+ * @see DepreciationsController::getIndex()
+ * @author [A. Gianotto] [<[email protected]>]
+ * @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 @@
<?php
-/**
- * This controller handles all actions related to User Groups for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
namespace App\Http\Controllers;
use Config;
@@ -18,13 +10,23 @@ use Validator;
use View;
use App\Models\Group;
+/**
+ * This controller handles all actions related to User Groups for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
class GroupsController extends Controller
{
/**
- * Show a list of all the groups.
- *
- * @return View
- */
+ * Returns a view that invokes the ajax tables which actually contains
+ * the content for the user group listing, which is generated in getDatatable.
+ *
+ * @author [A. Gianotto] [<[email protected]]
+ * @see GroupsController::getDatatable() method that generates the JSON response
+ * @since [v1.0]
+ * @return View
+ */
public function getIndex()
{
// Show the page
@@ -32,10 +34,13 @@ class GroupsController extends Controller
}
/**
- * Group create.
- *
- * @return View
- */
+ * Returns a view that displays a form to create a new User Group.
+ *
+ * @author [A. Gianotto] [<[email protected]]
+ * @see GroupsController::postCreate()
+ * @since [v1.0]
+ * @return View
+ */
public function getCreate()
{
$group = new Group;
@@ -50,10 +55,13 @@ class GroupsController extends Controller
}
/**
- * Group create form processing.
- *
- * @return Redirect
- */
+ * Validates and stores the new User Group data.
+ *
+ * @author [A. Gianotto] [<[email protected]]
+ * @see GroupsController::getCreate()
+ * @since [v1.0]
+ * @return Redirect
+ */
public function postCreate()
{
// create a new group instance
@@ -73,11 +81,14 @@ class GroupsController extends Controller
}
/**
- * Group update.
- *
- * @param int $id
- * @return View
- */
+ * Returns a view that presents a form to edit a User Group.
+ *
+ * @author [A. Gianotto] [<[email protected]]
+ * @see GroupsController::postEdit()
+ * @param int $id
+ * @since [v1.0]
+ * @return View
+ */
public function getEdit($id = null)
{
$group = Group::find($id);
@@ -90,11 +101,14 @@ class GroupsController extends Controller
}
/**
- * Group update form processing page.
- *
- * @param int $id
- * @return Redirect
- */
+ * Validates and stores the updated User Group data.
+ *
+ * @author [A. Gianotto] [<[email protected]]
+ * @see GroupsController::getEdit()
+ * @param int $id
+ * @since [v1.0]
+ * @return Redirect
+ */
public function postEdit($id = null)
{
@@ -120,11 +134,14 @@ class GroupsController extends Controller
}
/**
- * Delete the given group.
- *
- * @param int $id
- * @return Redirect
- */
+ * Validates and deletes the User Group.
+ *
+ * @author [A. Gianotto] [<[email protected]]
+ * @see GroupsController::getEdit()
+ * @param int $id
+ * @since [v1.0]
+ * @return Redirect
+ */
public function getDelete($id = null)
{
if (!config('app.lock_passwords')) {
@@ -147,8 +164,14 @@ class GroupsController extends Controller
}
-
- public function getDatatable($status = null)
+ /**
+ * Generates the JSON used to display the User Group listing.
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @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 @@
<?php
-/**
- * This controller handles all actions related to Licenses and
- * License Seats for the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
-
namespace App\Http\Controllers;
use Assets;
@@ -33,6 +24,12 @@ use Session;
use App\Helpers\Helper;
use Auth;
+/**
+ * This controller handles all actions related to Licenses for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
class LicensesController extends Controller
{
diff --git a/app/Http/Controllers/LocationsController.php b/app/Http/Controllers/LocationsController.php
index 732fc701fa..d7b7808563 100755
--- a/app/Http/Controllers/LocationsController.php
+++ b/app/Http/Controllers/LocationsController.php
@@ -1,13 +1,4 @@
<?php
-/**
- * This controller handles all actions related to Locations for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
-
namespace App\Http\Controllers;
use Input;
@@ -20,11 +11,14 @@ use Str;
use Validator;
use View;
use Auth;
-
-
-
use Symfony\Component\HttpFoundation\JsonResponse;
+/**
+ * This controller handles all actions related to Locations for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
class LocationsController extends Controller
{
diff --git a/app/Http/Controllers/ManufacturersController.php b/app/Http/Controllers/ManufacturersController.php
index 316526e2e9..be14a370b3 100755
--- a/app/Http/Controllers/ManufacturersController.php
+++ b/app/Http/Controllers/ManufacturersController.php
@@ -1,12 +1,4 @@
<?php
-/**
- * This controller handles all actions related to Manufacturers for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
namespace App\Http\Controllers;
use App\Models\Company;
@@ -19,6 +11,12 @@ use Str;
use View;
use Auth;
+/**
+ * This controller handles all actions related to Manufacturers for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
class ManufacturersController extends Controller
{
/**
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index 2f1de589da..c6acdc7c4d 100755
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -1,13 +1,4 @@
<?php
-/**
- * This controller handles user profile editing
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
-
namespace App\Http\Controllers;
use Image;
@@ -18,6 +9,12 @@ use View;
use Auth;
use App\Helpers\Helper;
+/**
+ * This controller handles all actions related to User Profiles for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
class ProfileController extends Controller
{
/**
diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php
index 80613a1c28..b0fc0b29d9 100644
--- a/app/Http/Controllers/ReportsController.php
+++ b/app/Http/Controllers/ReportsController.php
@@ -1,13 +1,4 @@
<?php
-/**
- * This controller handles all reporting actions for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
-
namespace App\Http\Controllers;
use App\Models\Accessory;
@@ -30,6 +21,12 @@ use Redirect;
use App\Models\Setting;
use App\Models\User;
+/**
+ * This controller handles all actions related to Reports for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
class ReportsController extends Controller
{
diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php
index 4721c7c7ee..8e3f376187 100755
--- a/app/Http/Controllers/SettingsController.php
+++ b/app/Http/Controllers/SettingsController.php
@@ -1,13 +1,4 @@
<?php
-/**
- * This controller handles all actions related to Settings for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
-
namespace App\Http\Controllers;
use Input;
@@ -28,7 +19,10 @@ use App\Http\Requests\SetupUserRequest;
use App\Http\Requests\SettingRequest;
/**
- * This class controls all actions related to settings
+ * This controller handles all actions related to Settings for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
*/
class SettingsController extends Controller
{
diff --git a/app/Http/Controllers/StatuslabelsController.php b/app/Http/Controllers/StatuslabelsController.php
index adafae1dfe..e0b74343ed 100755
--- a/app/Http/Controllers/StatuslabelsController.php
+++ b/app/Http/Controllers/StatuslabelsController.php
@@ -1,13 +1,4 @@
<?php
-/**
- * This controller handles all actions related to Status Labels for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
-
namespace App\Http\Controllers;
use Input;
@@ -23,6 +14,12 @@ use Auth;
use Symfony\Component\HttpFoundation\JsonResponse;
+/**
+ * This controller handles all actions related to Status Labels for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
class StatuslabelsController extends Controller
{
/**
diff --git a/app/Http/Controllers/SuppliersController.php b/app/Http/Controllers/SuppliersController.php
index 28bbda3602..d3093b69ad 100755
--- a/app/Http/Controllers/SuppliersController.php
+++ b/app/Http/Controllers/SuppliersController.php
@@ -1,13 +1,4 @@
<?php
-/**
- * This controller handles all actions related to Suppliers for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
-
namespace App\Http\Controllers;
use Image;
@@ -23,6 +14,12 @@ use Auth;
use Symfony\Component\HttpFoundation\JsonResponse;
+/**
+ * This controller handles all actions related to Suppliers for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
class SuppliersController extends Controller
{
/**
diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php
index eadab05dd0..15e7ad1f82 100755
--- a/app/Http/Controllers/UsersController.php
+++ b/app/Http/Controllers/UsersController.php
@@ -1,13 +1,4 @@
<?php
-/**
- * This controller handles all actions related to Users for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
-
namespace App\Http\Controllers;
use App\Http\Requests\SetupUserRequest;
@@ -39,7 +30,10 @@ use URL;
use View;
/**
- * This class controls all actions related to users
+ * This controller handles all actions related to Users for
+ * the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
*/
class UsersController extends Controller
{
diff --git a/app/Http/Controllers/ViewAssetsController.php b/app/Http/Controllers/ViewAssetsController.php
index 8f046652a9..e753177404 100755
--- a/app/Http/Controllers/ViewAssetsController.php
+++ b/app/Http/Controllers/ViewAssetsController.php
@@ -1,14 +1,4 @@
<?php
-/**
- * This controller handles all actions that allow a logged in user
- * to view the assets assigned to them (and request an asset) for
- * the Snipe-IT Asset Management application.
- *
- * PHP version 5.5.9
- * @package Snipe-IT
- * @version v1.0
- */
-
namespace App\Http\Controllers;
use App\Models\Accessory;
@@ -30,6 +20,12 @@ use Slack;
use Validator;
use View;
+/**
+ * This controller handles all actions related to the ability for users
+ * to view their own assets in the Snipe-IT Asset Management application.
+ *
+ * @version v1.0
+ */
class ViewAssetsController extends Controller
{
/**
diff --git a/app/Models/Accessory.php b/app/Models/Accessory.php
index 950797f45b..a7544826da 100755
--- a/app/Models/Accessory.php
+++ b/app/Models/Accessory.php
@@ -5,6 +5,11 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Watson\Validating\ValidatingTrait;
+/**
+ * Model for Accessories.
+ *
+ * @version v1.0
+ */
class Accessory extends Model
{
use SoftDeletes;
@@ -122,7 +127,7 @@ class Accessory 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/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 @@
<?php
+namespace App\Providers;
+
+use Validator;
+use Illuminate\Support\ServiceProvider;
+
/**
* This service provider handles a few custom validation rules.
*
* PHP version 5.5.9
- * @package Snipe-IT
* @version v3.0
*/
-namespace App\Providers;
-
-use Validator;
-use Illuminate\Support\ServiceProvider;
-
class AppServiceProvider extends ServiceProvider
{
/**