mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Moar typehinting
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
7330bf5832
commit
a1eafc108d
|
@ -6,8 +6,10 @@ use App\Helpers\StorageHelper;
|
|||
use App\Http\Requests\UploadFileRequest;
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\AssetModel;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use \Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
class AssetModelsFilesController extends Controller
|
||||
{
|
||||
|
@ -21,7 +23,7 @@ class AssetModelsFilesController extends Controller
|
|||
*@since [v1.0]
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*/
|
||||
public function store(UploadFileRequest $request, $modelId = null)
|
||||
public function store(UploadFileRequest $request, $modelId = null) : RedirectResponse
|
||||
{
|
||||
if (! $model = AssetModel::find($modelId)) {
|
||||
return redirect()->route('models.index')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
|
@ -54,10 +56,8 @@ class AssetModelsFilesController extends Controller
|
|||
* @param int $modelId
|
||||
* @param int $fileId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function show($modelId = null, $fileId = null)
|
||||
public function show($modelId = null, $fileId = null) : StreamedResponse | Response | RedirectResponse
|
||||
{
|
||||
$model = AssetModel::find($modelId);
|
||||
// the asset is valid
|
||||
|
@ -101,10 +101,8 @@ class AssetModelsFilesController extends Controller
|
|||
* @param int $modelId
|
||||
* @param int $fileId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function destroy($modelId = null, $fileId = null)
|
||||
public function destroy($modelId = null, $fileId = null) : RedirectResponse
|
||||
{
|
||||
$model = AssetModel::find($modelId);
|
||||
$this->authorize('update', $model);
|
||||
|
|
|
@ -5,7 +5,8 @@ namespace App\Http\Controllers;
|
|||
use App\Helpers\Helper;
|
||||
use App\Models\AssetModel;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
|
||||
class BulkAssetModelsController extends Controller
|
||||
{
|
||||
|
@ -15,9 +16,8 @@ class BulkAssetModelsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.7]
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function edit(Request $request)
|
||||
public function edit(Request $request) : View | RedirectResponse
|
||||
{
|
||||
$models_raw_array = $request->input('ids');
|
||||
|
||||
|
@ -60,9 +60,8 @@ class BulkAssetModelsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.7]
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(Request $request)
|
||||
public function update(Request $request): View | RedirectResponse
|
||||
{
|
||||
$this->authorize('update', AssetModel::class);
|
||||
|
||||
|
@ -104,9 +103,8 @@ class BulkAssetModelsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(Request $request)
|
||||
public function destroy(Request $request) : RedirectResponse
|
||||
{
|
||||
$this->authorize('delete', AssetModel::class);
|
||||
|
||||
|
|
|
@ -4,9 +4,11 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Helpers\Helper;
|
||||
use App\Http\Requests\ImageUploadRequest;
|
||||
use App\Models\Category as Category;
|
||||
use App\Models\Category;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
|
||||
/**
|
||||
* This class controls all actions related to Categories for
|
||||
|
@ -24,10 +26,8 @@ class CategoriesController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see CategoriesController::getDatatable() method that generates the JSON response
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function index()
|
||||
public function index() : View
|
||||
{
|
||||
// Show the page
|
||||
$this->authorize('view', Category::class);
|
||||
|
@ -41,10 +41,8 @@ class CategoriesController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see CategoriesController::store() method that stores the data
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function create()
|
||||
public function create() : View
|
||||
{
|
||||
// Show the page
|
||||
$this->authorize('create', Category::class);
|
||||
|
@ -60,10 +58,8 @@ class CategoriesController extends Controller
|
|||
* @see CategoriesController::create() method that makes the form.
|
||||
* @since [v1.0]
|
||||
* @param ImageUploadRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function store(ImageUploadRequest $request)
|
||||
public function store(ImageUploadRequest $request) : RedirectResponse
|
||||
{
|
||||
$this->authorize('create', Category::class);
|
||||
$category = new Category();
|
||||
|
@ -90,10 +86,8 @@ class CategoriesController extends Controller
|
|||
* @see CategoriesController::postEdit() method saves the data
|
||||
* @param int $categoryId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($categoryId = null)
|
||||
public function edit($categoryId = null) : RedirectResponse | View
|
||||
{
|
||||
$this->authorize('update', Category::class);
|
||||
if (is_null($item = Category::find($categoryId))) {
|
||||
|
@ -111,11 +105,9 @@ class CategoriesController extends Controller
|
|||
* @see CategoriesController::getEdit() method that makes the form.
|
||||
* @param ImageUploadRequest $request
|
||||
* @param int $categoryId
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
* @since [v1.0]
|
||||
*/
|
||||
public function update(ImageUploadRequest $request, $categoryId = null)
|
||||
public function update(ImageUploadRequest $request, $categoryId = null) : RedirectResponse
|
||||
{
|
||||
$this->authorize('update', Category::class);
|
||||
if (is_null($category = Category::find($categoryId))) {
|
||||
|
@ -149,10 +141,8 @@ class CategoriesController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @param int $categoryId
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function destroy($categoryId)
|
||||
public function destroy($categoryId) : RedirectResponse
|
||||
{
|
||||
$this->authorize('delete', Category::class);
|
||||
// Check if the category exists
|
||||
|
@ -177,11 +167,9 @@ class CategoriesController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see CategoriesController::getDataView() method that generates the JSON response
|
||||
* @param $id
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
* @since [v1.8]
|
||||
*/
|
||||
public function show($id)
|
||||
public function show($id) : View | RedirectResponse
|
||||
{
|
||||
$this->authorize('view', Category::class);
|
||||
if ($category = Category::find($id)) {
|
||||
|
|
|
@ -11,9 +11,8 @@ trait CheckInOutRequest
|
|||
{
|
||||
/**
|
||||
* Find target for checkout
|
||||
* @return SnipeModel Target asset is being checked out to.
|
||||
*/
|
||||
protected function determineCheckoutTarget()
|
||||
protected function determineCheckoutTarget() : ?SnipeModel
|
||||
{
|
||||
// This item is checked out to a location
|
||||
switch (request('checkout_to_type')) {
|
||||
|
@ -34,7 +33,7 @@ trait CheckInOutRequest
|
|||
* @param SnipeModel $target Target with location
|
||||
* @return Asset Asset being updated
|
||||
*/
|
||||
protected function updateAssetLocation($asset, $target)
|
||||
protected function updateAssetLocation($asset, $target) : Asset
|
||||
{
|
||||
switch (request('checkout_to_type')) {
|
||||
case 'location':
|
||||
|
|
|
@ -7,6 +7,8 @@ use App\Models\Company;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Companies for
|
||||
|
@ -21,10 +23,8 @@ final class CompaniesController extends Controller
|
|||
*
|
||||
* @author [Abdullah Alansari] [<ahimta@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function index()
|
||||
public function index() : View
|
||||
{
|
||||
$this->authorize('view', Company::class);
|
||||
|
||||
|
@ -36,10 +36,8 @@ final class CompaniesController extends Controller
|
|||
*
|
||||
* @author [Abdullah Alansari] [<ahimta@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function create()
|
||||
public function create() : View
|
||||
{
|
||||
$this->authorize('create', Company::class);
|
||||
|
||||
|
@ -52,10 +50,8 @@ final class CompaniesController extends Controller
|
|||
* @author [Abdullah Alansari] [<ahimta@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function store(ImageUploadRequest $request)
|
||||
public function store(ImageUploadRequest $request) : RedirectResponse
|
||||
{
|
||||
$this->authorize('create', Company::class);
|
||||
|
||||
|
@ -81,10 +77,8 @@ final class CompaniesController extends Controller
|
|||
* @author [Abdullah Alansari] [<ahimta@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @param int $companyId
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($companyId)
|
||||
public function edit($companyId) : View | RedirectResponse
|
||||
{
|
||||
if (is_null($item = Company::find($companyId))) {
|
||||
return redirect()->route('companies.index')
|
||||
|
@ -103,10 +97,8 @@ final class CompaniesController extends Controller
|
|||
* @since [v1.8]
|
||||
* @param ImageUploadRequest $request
|
||||
* @param int $companyId
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function update(ImageUploadRequest $request, $companyId)
|
||||
public function update(ImageUploadRequest $request, $companyId) : RedirectResponse
|
||||
{
|
||||
if (is_null($company = Company::find($companyId))) {
|
||||
return redirect()->route('companies.index')->with('error', trans('admin/companies/message.does_not_exist'));
|
||||
|
@ -135,10 +127,8 @@ final class CompaniesController extends Controller
|
|||
* @author [Abdullah Alansari] [<ahimta@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @param int $companyId
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function destroy($companyId)
|
||||
public function destroy($companyId) : RedirectResponse
|
||||
{
|
||||
if (is_null($company = Company::find($companyId))) {
|
||||
return redirect()->route('companies.index')
|
||||
|
@ -165,7 +155,7 @@ final class CompaniesController extends Controller
|
|||
->with('success', trans('admin/companies/message.delete.success'));
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
public function show($id) : View | RedirectResponse
|
||||
{
|
||||
$this->authorize('view', Company::class);
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ use App\Models\CustomField;
|
|||
use App\Models\CustomFieldset;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Custom Asset Fields for
|
||||
|
@ -25,10 +27,8 @@ class CustomFieldsController extends Controller
|
|||
*
|
||||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function index()
|
||||
public function index() : View
|
||||
{
|
||||
$this->authorize('view', CustomField::class);
|
||||
|
||||
|
@ -45,10 +45,8 @@ class CustomFieldsController extends Controller
|
|||
* @see CustomFieldsController::storeField()
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v5.1.5]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function show()
|
||||
public function show() : RedirectResponse
|
||||
{
|
||||
return redirect()->route('fields.index');
|
||||
}
|
||||
|
@ -60,10 +58,8 @@ class CustomFieldsController extends Controller
|
|||
* @see CustomFieldsController::storeField()
|
||||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function create(Request $request)
|
||||
public function create(Request $request) : View
|
||||
{
|
||||
$this->authorize('create', CustomField::class);
|
||||
$fieldsets = CustomFieldset::get();
|
||||
|
@ -82,10 +78,8 @@ class CustomFieldsController extends Controller
|
|||
* @see CustomFieldsController::createField()
|
||||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function store(CustomFieldRequest $request)
|
||||
public function store(CustomFieldRequest $request) : RedirectResponse
|
||||
{
|
||||
$this->authorize('create', CustomField::class);
|
||||
|
||||
|
@ -144,10 +138,8 @@ class CustomFieldsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.0]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function deleteFieldFromFieldset($field_id, $fieldset_id)
|
||||
public function deleteFieldFromFieldset($field_id, $fieldset_id) : RedirectResponse
|
||||
{
|
||||
$field = CustomField::find($field_id);
|
||||
|
||||
|
@ -176,10 +168,8 @@ class CustomFieldsController extends Controller
|
|||
*
|
||||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function destroy($field_id)
|
||||
public function destroy($field_id) : RedirectResponse
|
||||
{
|
||||
if ($field = CustomField::find($field_id)) {
|
||||
$this->authorize('delete', $field);
|
||||
|
@ -202,10 +192,8 @@ class CustomFieldsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $id
|
||||
* @since [v4.0]
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit(Request $request, $id)
|
||||
public function edit(Request $request, $id) : View | RedirectResponse
|
||||
{
|
||||
if ($field = CustomField::find($id)) {
|
||||
|
||||
|
@ -241,7 +229,7 @@ class CustomFieldsController extends Controller
|
|||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function update(CustomFieldRequest $request, $id)
|
||||
public function update(CustomFieldRequest $request, $id) : RedirectResponse
|
||||
{
|
||||
$field = CustomField::find($id);
|
||||
|
||||
|
|
|
@ -6,10 +6,9 @@ use App\Models\AssetModel;
|
|||
use App\Models\CustomField;
|
||||
use App\Models\CustomFieldset;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Redirect;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Custom Asset Fields for
|
||||
|
@ -23,7 +22,7 @@ use Redirect;
|
|||
class CustomFieldsetsController extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
public function index() : RedirectResponse
|
||||
{
|
||||
return redirect()->route("fields.index")
|
||||
->with("error", trans('admin/custom_fields/message.fieldset.does_not_exist'));
|
||||
|
@ -34,11 +33,9 @@ class CustomFieldsetsController extends Controller
|
|||
*
|
||||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @param int $id
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
* @since [v1.8]
|
||||
*/
|
||||
public function show($id)
|
||||
public function show($id) : View | RedirectResponse
|
||||
{
|
||||
$cfset = CustomFieldset::with('fields')
|
||||
->where('id', '=', $id)->orderBy('id', 'ASC')->first();
|
||||
|
@ -70,10 +67,8 @@ class CustomFieldsetsController extends Controller
|
|||
*
|
||||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function create()
|
||||
public function create() : View
|
||||
{
|
||||
$this->authorize('create', CustomField::class);
|
||||
|
||||
|
@ -89,7 +84,7 @@ class CustomFieldsetsController extends Controller
|
|||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(Request $request) : RedirectResponse
|
||||
{
|
||||
$this->authorize('create', CustomField::class);
|
||||
|
||||
|
@ -126,10 +121,8 @@ class CustomFieldsetsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $id
|
||||
* @since [v6.0.14]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($id)
|
||||
public function edit($id) : View | RedirectResponse
|
||||
{
|
||||
$this->authorize('create', CustomField::class);
|
||||
|
||||
|
@ -147,10 +140,8 @@ class CustomFieldsetsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $id
|
||||
* @since [v6.0.14]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function update(Request $request, $id) : RedirectResponse
|
||||
{
|
||||
$this->authorize('create', CustomField::class);
|
||||
|
||||
|
@ -175,10 +166,8 @@ class CustomFieldsetsController extends Controller
|
|||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @param int $id
|
||||
* @since [v1.8]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy($id) : RedirectResponse
|
||||
{
|
||||
$fieldset = CustomFieldset::find($id);
|
||||
|
||||
|
@ -203,9 +192,8 @@ class CustomFieldsetsController extends Controller
|
|||
*
|
||||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function associate(Request $request, $id)
|
||||
public function associate(Request $request, $id) : RedirectResponse
|
||||
{
|
||||
$set = CustomFieldset::find($id);
|
||||
|
||||
|
@ -232,7 +220,7 @@ class CustomFieldsetsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v5.0]
|
||||
*/
|
||||
public function makeFieldRequired($fieldset_id, $field_id)
|
||||
public function makeFieldRequired($fieldset_id, $field_id) : RedirectResponse
|
||||
{
|
||||
$this->authorize('update', CustomField::class);
|
||||
$field = CustomField::findOrFail($field_id);
|
||||
|
@ -250,7 +238,7 @@ class CustomFieldsetsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v5.0]
|
||||
*/
|
||||
public function makeFieldOptional($fieldset_id, $field_id)
|
||||
public function makeFieldOptional($fieldset_id, $field_id) : RedirectResponse
|
||||
{
|
||||
$this->authorize('update', CustomField::class);
|
||||
$field = CustomField::findOrFail($field_id);
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -21,9 +22,8 @@ class DashboardController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
public function index() : View | RedirectResponse
|
||||
{
|
||||
// Show the page
|
||||
if (auth()->user()->hasAccess('admin')) {
|
||||
|
|
|
@ -6,7 +6,8 @@ use App\Http\Requests\ImageUploadRequest;
|
|||
use App\Models\Department;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
|
@ -26,10 +27,8 @@ class DepartmentsController extends Controller
|
|||
* @see AssetController::getDatatable() method that generates the JSON response
|
||||
* @since [v4.0]
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index(Request $request) : View
|
||||
{
|
||||
$this->authorize('index', Department::class);
|
||||
$company = null;
|
||||
|
@ -46,10 +45,8 @@ class DepartmentsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v4.0]
|
||||
* @param ImageUploadRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function store(ImageUploadRequest $request)
|
||||
public function store(ImageUploadRequest $request) : RedirectResponse
|
||||
{
|
||||
$this->authorize('create', Department::class);
|
||||
$department = new Department;
|
||||
|
@ -74,10 +71,8 @@ class DepartmentsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $id
|
||||
* @since [v4.0]
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function show($id)
|
||||
public function show($id) : View | RedirectResponse
|
||||
{
|
||||
$department = Department::find($id);
|
||||
|
||||
|
@ -96,10 +91,8 @@ class DepartmentsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see DepartmentsController::postCreate() method that validates and stores the data
|
||||
* @since [v4.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function create()
|
||||
public function create() : View
|
||||
{
|
||||
$this->authorize('create', Department::class);
|
||||
|
||||
|
@ -112,10 +105,8 @@ class DepartmentsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $locationId
|
||||
* @since [v4.0]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy($id) : RedirectResponse
|
||||
{
|
||||
if (is_null($department = Department::find($id))) {
|
||||
return redirect()->to(route('departments.index'))->with('error', trans('admin/departments/message.not_found'));
|
||||
|
@ -146,10 +137,8 @@ class DepartmentsController extends Controller
|
|||
* @see LocationsController::postCreate() method that validates and stores
|
||||
* @param int $departmentId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($departmentId = null)
|
||||
public function edit($departmentId = null) : View | RedirectResponse
|
||||
{
|
||||
if (is_null($item = Department::find($departmentId))) {
|
||||
return redirect()->back()->with('error', trans('admin/locations/message.does_not_exist'));
|
||||
|
@ -167,10 +156,8 @@ class DepartmentsController extends Controller
|
|||
* @see LocationsController::postCreate() method that validates and stores
|
||||
* @param int $departmentId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function update(ImageUploadRequest $request, $id)
|
||||
public function update(ImageUploadRequest $request, $id) : RedirectResponse
|
||||
{
|
||||
if (is_null($department = Department::find($id))) {
|
||||
return redirect()->route('departments.index')->with('error', trans('admin/departments/message.does_not_exist'));
|
||||
|
|
|
@ -5,7 +5,8 @@ namespace App\Http\Controllers;
|
|||
use App\Models\Depreciation;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
/**
|
||||
* This controller handles all actions related to Depreciations for
|
||||
* the Snipe-IT Asset Management application.
|
||||
|
@ -21,14 +22,10 @@ class DepreciationsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net]
|
||||
* @see DepreciationsController::getDatatable() method that generates the JSON response
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function index()
|
||||
public function index() : View
|
||||
{
|
||||
$this->authorize('view', Depreciation::class);
|
||||
|
||||
// Show the page
|
||||
return view('depreciations/index');
|
||||
}
|
||||
|
||||
|
@ -38,10 +35,8 @@ class DepreciationsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net]
|
||||
* @see DepreciationsController::postCreate()
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function create()
|
||||
public function create() : View
|
||||
{
|
||||
$this->authorize('create', Depreciation::class);
|
||||
|
||||
|
@ -56,10 +51,8 @@ class DepreciationsController extends Controller
|
|||
* @see DepreciationsController::postCreate()
|
||||
* @since [v1.0]
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(Request $request) : RedirectResponse
|
||||
{
|
||||
$this->authorize('create', Depreciation::class);
|
||||
|
||||
|
@ -87,10 +80,8 @@ class DepreciationsController extends Controller
|
|||
* @see DepreciationsController::postEdit()
|
||||
* @param int $depreciationId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($depreciationId = null)
|
||||
public function edit($depreciationId = null) : RedirectResponse | View
|
||||
{
|
||||
// Check if the depreciation exists
|
||||
if (is_null($item = Depreciation::find($depreciationId))) {
|
||||
|
@ -110,11 +101,9 @@ class DepreciationsController extends Controller
|
|||
* @see DepreciationsController::getEdit()
|
||||
* @param Request $request
|
||||
* @param int $depreciationId
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @since [v1.0]
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function update(Request $request, $depreciationId = null)
|
||||
public function update(Request $request, $depreciationId = null) : RedirectResponse
|
||||
{
|
||||
// Check if the depreciation exists
|
||||
if (is_null($depreciation = Depreciation::find($depreciationId))) {
|
||||
|
@ -146,10 +135,8 @@ class DepreciationsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net]
|
||||
* @since [v1.0]
|
||||
* @param int $depreciationId
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function destroy($depreciationId)
|
||||
public function destroy($depreciationId) : RedirectResponse
|
||||
{
|
||||
// Check if the depreciation exists
|
||||
if (is_null($depreciation = Depreciation::withCount('models as models_count')->find($depreciationId))) {
|
||||
|
@ -175,10 +162,8 @@ class DepreciationsController extends Controller
|
|||
* @see DepreciationsController::postEdit()
|
||||
* @param int $depreciationId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function show($id)
|
||||
public function show($id) : View | RedirectResponse
|
||||
{
|
||||
if (is_null($depreciation = Depreciation::find($id))) {
|
||||
// Redirect to the blogs management page
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Laravel\Socialite\Facades\Socialite;
|
||||
|
@ -30,7 +30,7 @@ class GoogleAuthController extends Controller
|
|||
return Socialite::driver('google')->redirect();
|
||||
}
|
||||
|
||||
public function handleGoogleCallback()
|
||||
public function handleGoogleCallback() : RedirectResponse
|
||||
{
|
||||
try {
|
||||
$socialUser = Socialite::driver('google')->user();
|
||||
|
|
|
@ -5,7 +5,8 @@ namespace App\Http\Controllers;
|
|||
use App\Helpers\Helper;
|
||||
use App\Models\Group;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to User Groups for
|
||||
|
@ -22,11 +23,9 @@ class GroupsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net]
|
||||
* @see GroupsController::getDatatable() method that generates the JSON response
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
public function index(): View
|
||||
{
|
||||
// Show the page
|
||||
return view('groups/index');
|
||||
}
|
||||
|
||||
|
@ -36,9 +35,8 @@ class GroupsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net]
|
||||
* @see GroupsController::postCreate()
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function create(Request $request)
|
||||
public function create(Request $request) : View
|
||||
{
|
||||
$group = new Group;
|
||||
// Get all the available permissions
|
||||
|
@ -56,9 +54,8 @@ class GroupsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net]
|
||||
* @see GroupsController::getCreate()
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(Request $request) : RedirectResponse
|
||||
{
|
||||
// create a new group instance
|
||||
$group = new Group();
|
||||
|
@ -80,9 +77,8 @@ class GroupsController extends Controller
|
|||
* @see GroupsController::postEdit()
|
||||
* @param int $id
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function edit($id)
|
||||
public function edit($id) : View | RedirectResponse
|
||||
{
|
||||
$group = Group::find($id);
|
||||
|
||||
|
@ -104,9 +100,8 @@ class GroupsController extends Controller
|
|||
* @see GroupsController::getEdit()
|
||||
* @param int $id
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, $id = null)
|
||||
public function update(Request $request, $id = null) : RedirectResponse
|
||||
{
|
||||
if (! $group = Group::find($id)) {
|
||||
return redirect()->route('groups.index')->with('error', trans('admin/groups/message.group_not_found', ['id' => $id]));
|
||||
|
@ -132,10 +127,8 @@ class GroupsController extends Controller
|
|||
* @see GroupsController::getEdit()
|
||||
* @param int $id
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy($id) : RedirectResponse
|
||||
{
|
||||
if (! config('app.lock_passwords')) {
|
||||
if (! $group = Group::find($id)) {
|
||||
|
@ -154,10 +147,9 @@ class GroupsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param $id
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @since [v4.0.11]
|
||||
*/
|
||||
public function show($id)
|
||||
public function show($id) : View | RedirectResponse
|
||||
{
|
||||
$group = Group::find($id);
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@ use App\Http\Requests\ImageUploadRequest;
|
|||
use App\Models\Asset;
|
||||
use App\Models\Location;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
/**
|
||||
* This controller handles all actions related to Locations for
|
||||
* the Snipe-IT Asset Management application.
|
||||
|
@ -26,10 +26,8 @@ class LocationsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see LocationsController::getDatatable() method that generates the JSON response
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function index()
|
||||
public function index() : View
|
||||
{
|
||||
// Grab all the locations
|
||||
$this->authorize('view', Location::class);
|
||||
|
@ -43,10 +41,8 @@ class LocationsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see LocationsController::postCreate() method that validates and stores the data
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function create()
|
||||
public function create() : View
|
||||
{
|
||||
$this->authorize('create', Location::class);
|
||||
|
||||
|
@ -62,10 +58,8 @@ class LocationsController extends Controller
|
|||
* @see LocationsController::getCreate() method that makes the form
|
||||
* @since [v1.0]
|
||||
* @param ImageUploadRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function store(ImageUploadRequest $request)
|
||||
public function store(ImageUploadRequest $request) : RedirectResponse
|
||||
{
|
||||
$this->authorize('create', Location::class);
|
||||
$location = new Location();
|
||||
|
@ -80,7 +74,7 @@ class LocationsController extends Controller
|
|||
$location->zip = $request->input('zip');
|
||||
$location->ldap_ou = $request->input('ldap_ou');
|
||||
$location->manager_id = $request->input('manager_id');
|
||||
$location->user_id = Auth::id();
|
||||
$location->user_id = auth()->id();
|
||||
$location->phone = request('phone');
|
||||
$location->fax = request('fax');
|
||||
|
||||
|
@ -100,10 +94,8 @@ class LocationsController extends Controller
|
|||
* @see LocationsController::postCreate() method that validates and stores
|
||||
* @param int $locationId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($locationId = null)
|
||||
public function edit($locationId = null) : View | RedirectResponse
|
||||
{
|
||||
$this->authorize('update', Location::class);
|
||||
// Check if the location exists
|
||||
|
@ -121,11 +113,9 @@ class LocationsController extends Controller
|
|||
* @see LocationsController::getEdit() method that makes the form view
|
||||
* @param ImageUploadRequest $request
|
||||
* @param int $locationId
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
* @since [v1.0]
|
||||
*/
|
||||
public function update(ImageUploadRequest $request, $locationId = null)
|
||||
public function update(ImageUploadRequest $request, $locationId = null) : RedirectResponse
|
||||
{
|
||||
$this->authorize('update', Location::class);
|
||||
// Check if the location exists
|
||||
|
@ -163,10 +153,8 @@ class LocationsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $locationId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function destroy($locationId)
|
||||
public function destroy($locationId) : RedirectResponse
|
||||
{
|
||||
$this->authorize('delete', Location::class);
|
||||
if (is_null($location = Location::find($locationId))) {
|
||||
|
@ -202,9 +190,8 @@ class LocationsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $id
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function show($id = null)
|
||||
public function show($id = null) : View | RedirectResponse
|
||||
{
|
||||
$location = Location::find($id);
|
||||
|
||||
|
@ -215,7 +202,7 @@ class LocationsController extends Controller
|
|||
return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist'));
|
||||
}
|
||||
|
||||
public function print_assigned($id)
|
||||
public function print_assigned($id) : View | RedirectResponse
|
||||
{
|
||||
|
||||
if ($location = Location::where('id', $id)->first()) {
|
||||
|
@ -240,9 +227,8 @@ class LocationsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $locationId
|
||||
* @since [v6.0.14]
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function getClone($locationId = null)
|
||||
public function getClone($locationId = null) : View | RedirectResponse
|
||||
{
|
||||
$this->authorize('create', Location::class);
|
||||
|
||||
|
@ -263,7 +249,7 @@ class LocationsController extends Controller
|
|||
}
|
||||
|
||||
|
||||
public function print_all_assigned($id)
|
||||
public function print_all_assigned($id) : View | RedirectResponse
|
||||
{
|
||||
if ($location = Location::where('id', $id)->first()) {
|
||||
$parent = Location::where('id', $location->parent_id)->first();
|
||||
|
@ -282,9 +268,8 @@ class LocationsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v6.3.1]
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postBulkDelete(Request $request)
|
||||
public function postBulkDelete(Request $request) : View | RedirectResponse
|
||||
{
|
||||
$locations_raw_array = $request->input('ids');
|
||||
|
||||
|
@ -315,9 +300,10 @@ class LocationsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v6.3.1]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
|
||||
*/
|
||||
public function postBulkDeleteStore(Request $request) {
|
||||
public function postBulkDeleteStore(Request $request) : RedirectResponse
|
||||
{
|
||||
$locations_raw_array = $request->input('ids');
|
||||
|
||||
if ((is_array($locations_raw_array)) && (count($locations_raw_array) > 0)) {
|
||||
|
|
|
@ -2,17 +2,15 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Http\Requests\ImageUploadRequest;
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\Asset;
|
||||
use App\Models\Manufacturer;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Redirect;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Manufacturers for
|
||||
|
@ -29,13 +27,10 @@ class ManufacturersController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see Api\ManufacturersController::index() method that generates the JSON response
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function index()
|
||||
public function index() : View
|
||||
{
|
||||
$this->authorize('index', Manufacturer::class);
|
||||
|
||||
return view('manufacturers/index');
|
||||
}
|
||||
|
||||
|
@ -45,10 +40,8 @@ class ManufacturersController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see ManufacturersController::store()
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function create()
|
||||
public function create() : View
|
||||
{
|
||||
$this->authorize('create', Manufacturer::class);
|
||||
|
||||
|
@ -62,10 +55,8 @@ class ManufacturersController extends Controller
|
|||
* @see ManufacturersController::create()
|
||||
* @since [v1.0]
|
||||
* @param ImageUploadRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function store(ImageUploadRequest $request)
|
||||
public function store(ImageUploadRequest $request) : RedirectResponse
|
||||
{
|
||||
$this->authorize('create', Manufacturer::class);
|
||||
$manufacturer = new Manufacturer;
|
||||
|
@ -92,10 +83,8 @@ class ManufacturersController extends Controller
|
|||
* @see ManufacturersController::update()
|
||||
* @param int $manufacturerId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($manufacturerId = null)
|
||||
public function edit($manufacturerId = null) : View | RedirectResponse
|
||||
{
|
||||
// Handles manufacturer checks and permissions.
|
||||
$this->authorize('update', Manufacturer::class);
|
||||
|
@ -116,11 +105,9 @@ class ManufacturersController extends Controller
|
|||
* @see ManufacturersController::getEdit()
|
||||
* @param Request $request
|
||||
* @param int $manufacturerId
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @since [v1.0]
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function update(ImageUploadRequest $request, $manufacturerId = null)
|
||||
public function update(ImageUploadRequest $request, $manufacturerId = null) : RedirectResponse
|
||||
{
|
||||
$this->authorize('update', Manufacturer::class);
|
||||
// Check if the manufacturer exists
|
||||
|
@ -157,10 +144,8 @@ class ManufacturersController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $manufacturerId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function destroy($manufacturerId)
|
||||
public function destroy($manufacturerId) : RedirectResponse
|
||||
{
|
||||
$this->authorize('delete', Manufacturer::class);
|
||||
if (is_null($manufacturer = Manufacturer::withTrashed()->withCount('models as models_count')->find($manufacturerId))) {
|
||||
|
@ -197,10 +182,8 @@ class ManufacturersController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $manufacturerId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function show($manufacturerId = null)
|
||||
public function show($manufacturerId = null) : View | RedirectResponse
|
||||
{
|
||||
$this->authorize('view', Manufacturer::class);
|
||||
$manufacturer = Manufacturer::find($manufacturerId);
|
||||
|
@ -220,10 +203,8 @@ class ManufacturersController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v4.1.15]
|
||||
* @param int $manufacturers_id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function restore($id)
|
||||
public function restore($id) : RedirectResponse
|
||||
{
|
||||
$this->authorize('delete', Manufacturer::class);
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@ use Illuminate\Support\Facades\Auth;
|
|||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
/**
|
||||
* This controller handles all actions related to User Profiles for
|
||||
* the Snipe-IT Asset Management application.
|
||||
|
@ -24,9 +25,8 @@ class ProfileController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getIndex()
|
||||
public function getIndex() : View
|
||||
{
|
||||
$this->authorize('self.profile');
|
||||
$user = auth()->user();
|
||||
|
@ -38,9 +38,8 @@ class ProfileController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postIndex(ImageUploadRequest $request)
|
||||
public function postIndex(ImageUploadRequest $request) : RedirectResponse
|
||||
{
|
||||
$this->authorize('self.profile');
|
||||
$user = auth()->user();
|
||||
|
@ -84,7 +83,7 @@ class ProfileController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v4.0]
|
||||
*/
|
||||
public function api(): \Illuminate\Contracts\View\View
|
||||
public function api(): View
|
||||
{
|
||||
// Make sure the self.api permission has been granted
|
||||
if (!Gate::allows('self.api')) {
|
||||
|
@ -97,21 +96,17 @@ class ProfileController extends Controller
|
|||
/**
|
||||
* User change email page.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function password()
|
||||
public function password() : View
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
return view('account/change-password', compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Users change password form processing page.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function passwordSave(Request $request)
|
||||
public function passwordSave(Request $request) : RedirectResponse
|
||||
{
|
||||
if (config('app.lock_passwords')) {
|
||||
return redirect()->route('account.password.index')->with('error', trans('admin/users/table.lock_passwords'));
|
||||
|
@ -178,9 +173,8 @@ class ProfileController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v4.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getMenuState(Request $request)
|
||||
public function getMenuState(Request $request) : void
|
||||
{
|
||||
if ($request->input('state') == 'open') {
|
||||
$request->session()->put('menu_state', 'open');
|
||||
|
@ -195,9 +189,8 @@ class ProfileController extends Controller
|
|||
*
|
||||
* @author A. Gianotto
|
||||
* @since [v6.0.12]
|
||||
* @return Illuminate\View\View
|
||||
*/
|
||||
public function printInventory()
|
||||
public function printInventory() : View
|
||||
{
|
||||
$show_user = auth()->user();
|
||||
|
||||
|
@ -215,9 +208,8 @@ class ProfileController extends Controller
|
|||
*
|
||||
* @author A. Gianotto
|
||||
* @since [v6.0.12]
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function emailAssetList()
|
||||
public function emailAssetList() : RedirectResponse
|
||||
{
|
||||
|
||||
if (!$user = User::find(auth()->id())) {
|
||||
|
|
|
@ -6,6 +6,8 @@ use App\Helpers\Helper;
|
|||
use App\Models\Accessory;
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\Asset;
|
||||
use App\Models\AssetModel;
|
||||
use App\Models\Category;
|
||||
use App\Models\AssetMaintenance;
|
||||
use App\Models\CheckoutAcceptance;
|
||||
use App\Models\CustomField;
|
||||
|
@ -14,17 +16,16 @@ use App\Models\License;
|
|||
use App\Models\Setting;
|
||||
use App\Notifications\CheckoutAssetNotification;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
use League\Csv\Reader;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use League\Csv\EscapeFormula;
|
||||
use App\Http\Requests\CustomAssetReportRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Reports for
|
||||
|
@ -49,7 +50,7 @@ class ReportsController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getAccessoryReport()
|
||||
public function getAccessoryReport() : View
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
|
||||
|
@ -65,7 +66,7 @@ class ReportsController extends Controller
|
|||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function exportAccessoryReport()
|
||||
public function exportAccessoryReport() : Response
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
$accessories = Accessory::orderBy('created_at', 'DESC')->get();
|
||||
|
@ -104,9 +105,8 @@ class ReportsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getDeprecationReport()
|
||||
public function getDeprecationReport() : View
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
$depreciations = Depreciation::get();
|
||||
|
@ -119,9 +119,8 @@ class ReportsController extends Controller
|
|||
* @deprecated Server-side exports have been replaced by datatables export since v2.
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function exportDeprecationReport()
|
||||
public function exportDeprecationReport() : Response
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
// Grab all the assets
|
||||
|
@ -197,12 +196,10 @@ class ReportsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v4.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function audit()
|
||||
public function audit() : View
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
|
||||
return view('reports/audit');
|
||||
}
|
||||
|
||||
|
@ -212,9 +209,8 @@ class ReportsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getActivityReport()
|
||||
public function getActivityReport() : View
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
|
||||
|
@ -226,9 +222,8 @@ class ReportsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v5.0.7]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function postActivityReport(Request $request)
|
||||
public function postActivityReport(Request $request) : StreamedResponse
|
||||
{
|
||||
ini_set('max_execution_time', 12000);
|
||||
$this->authorize('reports.view');
|
||||
|
@ -328,9 +323,8 @@ class ReportsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getLicenseReport()
|
||||
public function getLicenseReport() : View
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
$licenses = License::with('depreciation')->orderBy('created_at', 'DESC')
|
||||
|
@ -346,9 +340,8 @@ class ReportsController extends Controller
|
|||
* @deprecated Server-side exports have been replaced by datatables export since v2.
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function exportLicenseReport()
|
||||
public function exportLicenseReport() : Response
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
$licenses = License::orderBy('created_at', 'DESC')->get();
|
||||
|
@ -398,9 +391,8 @@ class ReportsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see ReportsController::postCustomReport() method that generates the CSV
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getCustomReport()
|
||||
public function getCustomReport() : View
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
$customfields = CustomField::get();
|
||||
|
@ -414,9 +406,8 @@ class ReportsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @see ReportsController::getCustomReport() method that generates form view
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function postCustom(CustomAssetReportRequest $request)
|
||||
public function postCustom(CustomAssetReportRequest $request) : StreamedResponse
|
||||
{
|
||||
ini_set('max_execution_time', env('REPORT_TIME_LIMIT', 12000)); //12000 seconds = 200 minutes
|
||||
$this->authorize('reports.view');
|
||||
|
@ -681,15 +672,15 @@ class ReportsController extends Controller
|
|||
}
|
||||
|
||||
if (($request->filled('created_start')) && ($request->filled('created_end'))) {
|
||||
$created_start = \Carbon::parse($request->input('created_start'))->startOfDay();
|
||||
$created_end = \Carbon::parse($request->input('created_end'))->endOfDay();
|
||||
$created_start = Carbon::parse($request->input('created_start'))->startOfDay();
|
||||
$created_end = Carbon::parse($request->input('created_end'))->endOfDay();
|
||||
|
||||
$assets->whereBetween('assets.created_at', [$created_start, $created_end]);
|
||||
}
|
||||
|
||||
if (($request->filled('checkout_date_start')) && ($request->filled('checkout_date_end'))) {
|
||||
$checkout_start = \Carbon::parse($request->input('checkout_date_start'))->startOfDay();
|
||||
$checkout_end = \Carbon::parse($request->input('checkout_date_end',now()))->endOfDay();
|
||||
$checkout_start = Carbon::parse($request->input('checkout_date_start'))->startOfDay();
|
||||
$checkout_end = Carbon::parse($request->input('checkout_date_end',now()))->endOfDay();
|
||||
|
||||
$actionlogassets = Actionlog::where('action_type','=', 'checkout')
|
||||
->where('item_type', 'LIKE', '%Asset%',)
|
||||
|
@ -700,9 +691,9 @@ class ReportsController extends Controller
|
|||
}
|
||||
|
||||
if (($request->filled('checkin_date_start'))) {
|
||||
$checkin_start = \Carbon::parse($request->input('checkin_date_start'))->startOfDay();
|
||||
$checkin_start = Carbon::parse($request->input('checkin_date_start'))->startOfDay();
|
||||
// use today's date is `checkin_date_end` is not provided
|
||||
$checkin_end = \Carbon::parse($request->input('checkin_date_end', now()))->endOfDay();
|
||||
$checkin_end = Carbon::parse($request->input('checkin_date_end', now()))->endOfDay();
|
||||
|
||||
$assets->whereBetween('assets.last_checkin', [$checkin_start, $checkin_end ]);
|
||||
}
|
||||
|
@ -713,8 +704,8 @@ class ReportsController extends Controller
|
|||
}
|
||||
|
||||
if (($request->filled('last_audit_start')) && ($request->filled('last_audit_end'))) {
|
||||
$last_audit_start = \Carbon::parse($request->input('last_audit_start'))->startOfDay();
|
||||
$last_audit_end = \Carbon::parse($request->input('last_audit_end'))->endOfDay();
|
||||
$last_audit_start = Carbon::parse($request->input('last_audit_start'))->startOfDay();
|
||||
$last_audit_end = Carbon::parse($request->input('last_audit_end'))->endOfDay();
|
||||
|
||||
$assets->whereBetween('assets.last_audit_date', [$last_audit_start, $last_audit_end]);
|
||||
}
|
||||
|
@ -1015,11 +1006,10 @@ class ReportsController extends Controller
|
|||
/**
|
||||
* getImprovementsReport
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function getAssetMaintenancesReport()
|
||||
public function getAssetMaintenancesReport() : View
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
|
||||
|
@ -1029,11 +1019,10 @@ class ReportsController extends Controller
|
|||
/**
|
||||
* exportImprovementsReport
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function exportAssetMaintenancesReport()
|
||||
public function exportAssetMaintenancesReport() : Response
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
// Grab all the improvements
|
||||
|
@ -1090,13 +1079,10 @@ class ReportsController extends Controller
|
|||
/**
|
||||
* getAssetAcceptanceReport
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function getAssetAcceptanceReport($deleted = false)
|
||||
public function getAssetAcceptanceReport($deleted = false) : View
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
$showDeleted = $deleted == 'deleted';
|
||||
|
@ -1132,11 +1118,9 @@ class ReportsController extends Controller
|
|||
* sentAssetAcceptanceReminder
|
||||
*
|
||||
* @param integer|null $acceptanceId
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
* @version v1.0
|
||||
*/
|
||||
public function sentAssetAcceptanceReminder(Request $request)
|
||||
public function sentAssetAcceptanceReminder(Request $request) : RedirectResponse
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
|
||||
|
@ -1190,11 +1174,9 @@ class ReportsController extends Controller
|
|||
* sentAssetAcceptanceReminder
|
||||
*
|
||||
* @param integer|null $acceptanceId
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
* @version v1.0
|
||||
*/
|
||||
public function deleteAssetAcceptance($acceptanceId = null)
|
||||
public function deleteAssetAcceptance($acceptanceId = null) : RedirectResponse
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
|
||||
|
@ -1213,11 +1195,10 @@ class ReportsController extends Controller
|
|||
/**
|
||||
* Exports the AssetAcceptance report to CSV
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
public function postAssetAcceptanceReport($deleted = false)
|
||||
public function postAssetAcceptanceReport($deleted = false) : Response
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
$showDeleted = $deleted == 'deleted';
|
||||
|
@ -1284,7 +1265,7 @@ class ReportsController extends Controller
|
|||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function getCheckedOutAssetsRequiringAcceptance($modelsInCategoriesThatRequireAcceptance)
|
||||
protected function getCheckedOutAssetsRequiringAcceptance($modelsInCategoriesThatRequireAcceptance) : View
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
$assets = Asset::deployed()
|
||||
|
@ -1304,11 +1285,11 @@ class ReportsController extends Controller
|
|||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function getModelsInCategoriesThatRequireAcceptance($assetCategoriesRequiringAcceptance)
|
||||
protected function getModelsInCategoriesThatRequireAcceptance($assetCategoriesRequiringAcceptance) : array
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
|
||||
return array_pluck(Model::inCategory($assetCategoriesRequiringAcceptance)
|
||||
return array_pluck(AssetModel::inCategory($assetCategoriesRequiringAcceptance)
|
||||
->select('id')
|
||||
->get()
|
||||
->toArray(), 'id');
|
||||
|
@ -1321,7 +1302,7 @@ class ReportsController extends Controller
|
|||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function getCategoriesThatRequireAcceptance()
|
||||
protected function getCategoriesThatRequireAcceptance() : array
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
|
||||
|
@ -1334,11 +1315,10 @@ class ReportsController extends Controller
|
|||
/**
|
||||
* getAssetsCheckedOutRequiringAcceptance
|
||||
*
|
||||
* @return array
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
protected function getAssetsCheckedOutRequiringAcceptance()
|
||||
protected function getAssetsCheckedOutRequiringAcceptance() : array
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ use Illuminate\Http\Request;
|
|||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
@ -49,7 +50,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\Response
|
||||
*/
|
||||
public function getSetupIndex()
|
||||
public function getSetupIndex() : View
|
||||
{
|
||||
$start_settings['php_version_min'] = false;
|
||||
|
||||
|
@ -123,7 +124,7 @@ class SettingsController extends Controller
|
|||
* @return bool This method will return true when exceptions (such as curl exception) is thrown.
|
||||
* Check the log files to see more details about the exception.
|
||||
*/
|
||||
protected function dotEnvFileIsExposed()
|
||||
protected function dotEnvFileIsExposed() : bool
|
||||
{
|
||||
try {
|
||||
return Http::timeout(10)
|
||||
|
@ -153,12 +154,11 @@ class SettingsController extends Controller
|
|||
* Save the first admin user from Setup.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v3.0]
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postSaveFirstAdmin(SetupUserRequest $request)
|
||||
public function postSaveFirstAdmin(SetupUserRequest $request) : RedirectResponse
|
||||
{
|
||||
{
|
||||
$user = new User();
|
||||
$user->first_name = $data['first_name'] = $request->input('first_name');
|
||||
|
@ -214,10 +214,8 @@ class SettingsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v3.0]
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getSetupUser()
|
||||
public function getSetupUser() : View
|
||||
{
|
||||
return view('setup/user')
|
||||
->with('step', 3)
|
||||
|
@ -230,10 +228,8 @@ class SettingsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v3.0]
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getSetupDone()
|
||||
public function getSetupDone() : View
|
||||
{
|
||||
return view('setup/done')
|
||||
->with('step', 4)
|
||||
|
@ -247,10 +243,8 @@ class SettingsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v3.0]
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getSetupMigrate()
|
||||
public function getSetupMigrate() : View
|
||||
{
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
if ((! file_exists(storage_path().'/oauth-private.key')) || (! file_exists(storage_path().'/oauth-public.key'))) {
|
||||
|
@ -270,10 +264,8 @@ class SettingsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
public function index() : View
|
||||
{
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
|
@ -286,10 +278,9 @@ class SettingsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getEdit()
|
||||
public function getEdit() : View
|
||||
|
||||
{
|
||||
$setting = Setting::getSettings();
|
||||
|
||||
|
@ -302,10 +293,8 @@ class SettingsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getSettings()
|
||||
public function getSettings() : View
|
||||
{
|
||||
$setting = Setting::getSettings();
|
||||
|
||||
|
@ -318,10 +307,9 @@ class SettingsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postSettings(Request $request)
|
||||
public function postSettings(Request $request) : RedirectResponse
|
||||
|
||||
{
|
||||
if (is_null($setting = Setting::getSettings())) {
|
||||
return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error'));
|
||||
|
@ -375,10 +363,8 @@ class SettingsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getBranding()
|
||||
public function getBranding() : View
|
||||
{
|
||||
$setting = Setting::getSettings();
|
||||
|
||||
|
@ -391,10 +377,8 @@ class SettingsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postBranding(ImageUploadRequest $request)
|
||||
public function postBranding(ImageUploadRequest $request) : RedirectResponse
|
||||
{
|
||||
// Something has gone horribly wrong - no settings record exists!
|
||||
if (is_null($setting = Setting::getSettings())) {
|
||||
|
@ -493,10 +477,8 @@ class SettingsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getSecurity()
|
||||
public function getSecurity() : View
|
||||
{
|
||||
$setting = Setting::getSettings();
|
||||
|
||||
|
@ -509,10 +491,8 @@ class SettingsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postSecurity(Request $request)
|
||||
public function postSecurity(Request $request) : RedirectResponse
|
||||
{
|
||||
$this->validate($request, [
|
||||
'pwd_secure_complexity' => 'array',
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Models\AssetModel;
|
||||
use App\Models\Category;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class StoreAssetModelRequest extends ImageUploadRequest
|
||||
{
|
||||
|
@ -13,7 +14,7 @@ class StoreAssetModelRequest extends ImageUploadRequest
|
|||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
return Gate::allows('create', new AssetModel);
|
||||
}
|
||||
|
||||
public function prepareForValidation(): void
|
||||
|
|
Loading…
Reference in a new issue