mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Modernize use statements, switch to auth()
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
e98284fff5
commit
ae9085b11f
|
@ -2,17 +2,14 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Asset;
|
||||
use App\Models\AssetMaintenance;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Slack;
|
||||
use Str;
|
||||
use TCPDF;
|
||||
use View;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
use \Illuminate\Http\RedirectResponse;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Asset Maintenance for
|
||||
|
@ -29,9 +26,8 @@ class AssetMaintenancesController extends Controller
|
|||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
* @since [v1.8]
|
||||
* @return View
|
||||
*/
|
||||
private static function getInsufficientPermissionsRedirect()
|
||||
private static function getInsufficientPermissionsRedirect(): RedirectResponse
|
||||
{
|
||||
return redirect()->route('maintenances.index')
|
||||
->with('error', trans('general.insufficient_permissions'));
|
||||
|
@ -46,9 +42,8 @@ class AssetMaintenancesController extends Controller
|
|||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
* @since [v1.8]
|
||||
* @return View
|
||||
*/
|
||||
public function index()
|
||||
public function index() : View
|
||||
{
|
||||
$this->authorize('view', Asset::class);
|
||||
return view('asset_maintenances/index');
|
||||
|
@ -63,7 +58,7 @@ class AssetMaintenancesController extends Controller
|
|||
* @since [v1.8]
|
||||
* @return mixed
|
||||
*/
|
||||
public function create()
|
||||
public function create() : View
|
||||
{
|
||||
$this->authorize('update', Asset::class);
|
||||
$asset = null;
|
||||
|
@ -92,9 +87,8 @@ class AssetMaintenancesController extends Controller
|
|||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
* @since [v1.8]
|
||||
* @return mixed
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store(Request $request) : RedirectResponse
|
||||
{
|
||||
$this->authorize('update', Asset::class);
|
||||
// create a new model instance
|
||||
|
@ -144,9 +138,8 @@ class AssetMaintenancesController extends Controller
|
|||
* @param int $assetMaintenanceId
|
||||
* @version v1.0
|
||||
* @since [v1.8]
|
||||
* @return mixed
|
||||
*/
|
||||
public function edit($assetMaintenanceId = null)
|
||||
public function edit($assetMaintenanceId = null) : View | RedirectResponse
|
||||
{
|
||||
$this->authorize('update', Asset::class);
|
||||
// Check if the asset maintenance exists
|
||||
|
@ -162,14 +155,9 @@ class AssetMaintenancesController extends Controller
|
|||
return static::getInsufficientPermissionsRedirect();
|
||||
}
|
||||
|
||||
|
||||
// Prepare Improvement Type List
|
||||
$assetMaintenanceType = [
|
||||
'' => 'Select an improvement type',
|
||||
] + AssetMaintenance::getImprovementOptions();
|
||||
$assetMaintenanceType = ['' => 'Select an improvement type'] + AssetMaintenance::getImprovementOptions();
|
||||
|
||||
// Get Supplier List
|
||||
// Render the view
|
||||
return view('asset_maintenances/edit')
|
||||
->with('selectedAsset', null)
|
||||
->with('assetMaintenanceType', $assetMaintenanceType)
|
||||
|
@ -183,11 +171,10 @@ class AssetMaintenancesController extends Controller
|
|||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @param Request $request
|
||||
* @param int $assetMaintenanceId
|
||||
* @return mixed
|
||||
* @version v1.0
|
||||
* @since [v1.8]
|
||||
*/
|
||||
public function update(Request $request, $assetMaintenanceId = null)
|
||||
public function update(Request $request, $assetMaintenanceId = null) : View | RedirectResponse
|
||||
{
|
||||
$this->authorize('update', Asset::class);
|
||||
// Check if the asset maintenance exists
|
||||
|
@ -255,9 +242,8 @@ class AssetMaintenancesController extends Controller
|
|||
* @param int $assetMaintenanceId
|
||||
* @version v1.0
|
||||
* @since [v1.8]
|
||||
* @return mixed
|
||||
*/
|
||||
public function destroy($assetMaintenanceId)
|
||||
public function destroy($assetMaintenanceId) : RedirectResponse
|
||||
{
|
||||
$this->authorize('update', Asset::class);
|
||||
// Check if the asset maintenance exists
|
||||
|
@ -284,9 +270,8 @@ class AssetMaintenancesController extends Controller
|
|||
* @param int $assetMaintenanceId
|
||||
* @version v1.0
|
||||
* @since [v1.8]
|
||||
* @return View
|
||||
*/
|
||||
public function show($assetMaintenanceId)
|
||||
public function show($assetMaintenanceId) : View | RedirectResponse
|
||||
{
|
||||
$this->authorize('view', Asset::class);
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class AssetModelsFilesController extends Controller
|
|||
* @param int $modelId
|
||||
* @param int $fileId
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function show($modelId = null, $fileId = null)
|
||||
|
@ -101,7 +101,7 @@ class AssetModelsFilesController extends Controller
|
|||
* @param int $modelId
|
||||
* @param int $fileId
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function destroy($modelId = null, $fileId = null)
|
||||
|
|
|
@ -26,7 +26,7 @@ class AssetCheckinController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $assetId
|
||||
* @param string $backto
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
* @since [v1.0]
|
||||
*/
|
||||
|
@ -136,7 +136,7 @@ class AssetCheckinController extends Controller
|
|||
// Was the asset updated?
|
||||
if ($asset->save()) {
|
||||
|
||||
event(new CheckoutableCheckedIn($asset, $target, Auth::user(), $request->input('note'), $checkin_at, $originalValues));
|
||||
event(new CheckoutableCheckedIn($asset, $target, auth()->user(), $request->input('note'), $checkin_at, $originalValues));
|
||||
return Helper::getRedirectOption($asset, $assetId, 'Assets');
|
||||
}
|
||||
// Redirect to the asset management page with error
|
||||
|
|
|
@ -23,7 +23,7 @@ class AssetCheckoutController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $assetId
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function create($assetId)
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ class AssetCheckoutController extends Controller
|
|||
return redirect()->route('hardware.show', $asset->id)->with('error', trans('admin/hardware/general.model_invalid_fix'));
|
||||
}
|
||||
|
||||
$admin = Auth::user();
|
||||
$admin = auth()->user();
|
||||
|
||||
$target = $this->determineCheckoutTarget();
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class AssetFilesController extends Controller
|
|||
* @param int $assetId
|
||||
* @param int $fileId
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function show($assetId = null, $fileId = null)
|
||||
|
@ -105,7 +105,7 @@ class AssetFilesController extends Controller
|
|||
* @param int $assetId
|
||||
* @param int $fileId
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function destroy($assetId = null, $fileId = null)
|
||||
|
|
|
@ -55,7 +55,7 @@ class AssetsController extends Controller
|
|||
* @see AssetController::getDatatable() method that generates the JSON response
|
||||
* @since [v1.0]
|
||||
* @param Request $request
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function index(Request $request)
|
||||
|
@ -72,7 +72,7 @@ class AssetsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @param Request $request
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @internal param int $model_id
|
||||
*/
|
||||
public function create(Request $request)
|
||||
|
@ -198,7 +198,7 @@ class AssetsController extends Controller
|
|||
}
|
||||
|
||||
if (isset($target)) {
|
||||
$asset->checkOut($target, Auth::user(), date('Y-m-d H:i:s'), $request->input('expected_checkin', null), 'Checked out on asset creation', $request->get('name'), $location);
|
||||
$asset->checkOut($target, auth()->user(), date('Y-m-d H:i:s'), $request->input('expected_checkin', null), 'Checked out on asset creation', $request->get('name'), $location);
|
||||
}
|
||||
|
||||
$success = true;
|
||||
|
@ -229,7 +229,7 @@ class AssetsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $assetId
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit($assetId = null)
|
||||
{
|
||||
|
@ -252,7 +252,7 @@ class AssetsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $assetId
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function show($assetId = null)
|
||||
{
|
||||
|
@ -561,7 +561,7 @@ class AssetsController extends Controller
|
|||
*
|
||||
* @author [L. Swartzendruber] [<logan.swartzendruber@gmail.com>
|
||||
* @param int $assetId
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getLabel($assetId = null)
|
||||
{
|
||||
|
@ -585,7 +585,7 @@ class AssetsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $assetId
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getClone($assetId = null)
|
||||
{
|
||||
|
@ -614,7 +614,7 @@ class AssetsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getImportHistory()
|
||||
{
|
||||
|
@ -636,7 +636,7 @@ class AssetsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.3]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function postImportHistory(Request $request)
|
||||
{
|
||||
|
@ -730,8 +730,8 @@ class AssetsController extends Controller
|
|||
Actionlog::firstOrCreate([
|
||||
'item_id' => $asset->id,
|
||||
'item_type' => Asset::class,
|
||||
'user_id' => Auth::user()->id,
|
||||
'note' => 'Checkout imported by '.Auth::user()->present()->fullName().' from history importer',
|
||||
'user_id' => auth()->id(),
|
||||
'note' => 'Checkout imported by '.auth()->user()->present()->fullName().' from history importer',
|
||||
'target_id' => $item[$asset_tag][$batch_counter]['user_id'],
|
||||
'target_type' => User::class,
|
||||
'created_at' => $item[$asset_tag][$batch_counter]['checkout_date'],
|
||||
|
@ -758,8 +758,8 @@ class AssetsController extends Controller
|
|||
Actionlog::firstOrCreate([
|
||||
'item_id' => $item[$asset_tag][$batch_counter]['asset_id'],
|
||||
'item_type' => Asset::class,
|
||||
'user_id' => Auth::user()->id,
|
||||
'note' => 'Checkin imported by '.Auth::user()->present()->fullName().' from history importer',
|
||||
'user_id' => auth()->id(),
|
||||
'note' => 'Checkin imported by '.auth()->user()->present()->fullName().' from history importer',
|
||||
'target_id' => null,
|
||||
'created_at' => $checkin_date,
|
||||
'action_type' => 'checkin',
|
||||
|
@ -796,7 +796,7 @@ class AssetsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $assetId
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getRestore($assetId = null)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ class BulkAssetsController extends Controller
|
|||
* action would make a lot more sense here and make things a lot more clear.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @internal param int $assetId
|
||||
* @since [v2.0]
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
|
@ -471,7 +471,7 @@ class BulkAssetsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param Request $request
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
* @internal param array $assets
|
||||
* @since [v2.0]
|
||||
|
@ -505,7 +505,7 @@ class BulkAssetsController extends Controller
|
|||
|
||||
/**
|
||||
* Show Bulk Checkout Page
|
||||
* @return View View to checkout multiple assets
|
||||
* @return \Illuminate\Contracts\View\View View to checkout multiple assets
|
||||
*/
|
||||
public function showCheckout()
|
||||
{
|
||||
|
@ -517,7 +517,7 @@ class BulkAssetsController extends Controller
|
|||
|
||||
/**
|
||||
* Process Multiple Checkout Request
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function storeCheckout(AssetCheckoutRequest $request)
|
||||
{
|
||||
|
@ -525,7 +525,7 @@ class BulkAssetsController extends Controller
|
|||
$this->authorize('checkout', Asset::class);
|
||||
|
||||
try {
|
||||
$admin = Auth::user();
|
||||
$admin = auth()->user();
|
||||
|
||||
$target = $this->determineCheckoutTarget();
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ class LoginController extends Controller
|
|||
$saml->clearData();
|
||||
}
|
||||
|
||||
if ($user = Auth::user()) {
|
||||
if ($user = auth()->user()) {
|
||||
$user->last_login = \Carbon::now();
|
||||
$user->saveQuietly();
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ class LoginController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
if ($user = Auth::user()) {
|
||||
if ($user = auth()->user()) {
|
||||
$user->last_login = \Carbon::now();
|
||||
$user->activated = 1;
|
||||
$user->saveQuietly();
|
||||
|
@ -350,7 +350,7 @@ class LoginController extends Controller
|
|||
}
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
$user = Auth::user();
|
||||
$user = auth()->user();
|
||||
|
||||
// We wouldn't normally see this page if 2FA isn't enforced via the
|
||||
// \App\Http\Middleware\CheckForTwoFactor middleware AND if a device isn't enrolled,
|
||||
|
@ -398,7 +398,7 @@ class LoginController extends Controller
|
|||
return redirect()->route('login')->with('error', trans('auth/general.login_prompt'));
|
||||
}
|
||||
|
||||
$user = Auth::user();
|
||||
$user = auth()->user();
|
||||
|
||||
// Check whether there is a device enrolled.
|
||||
// This *should* be handled via the \App\Http\Middleware\CheckForTwoFactor middleware
|
||||
|
@ -427,7 +427,7 @@ class LoginController extends Controller
|
|||
return redirect()->route('two-factor')->with('error', trans('auth/message.two_factor.code_required'));
|
||||
}
|
||||
|
||||
$user = Auth::user();
|
||||
$user = auth()->user();
|
||||
$secret = $request->input('two_factor_secret');
|
||||
|
||||
if (Google2FA::verifyKey($user->two_factor_secret, $secret)) {
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace App\Http\Controllers;
|
|||
use App\Helpers\Helper;
|
||||
use App\Models\AssetModel;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
|
||||
class BulkAssetModelsController extends Controller
|
||||
|
@ -16,7 +15,7 @@ class BulkAssetModelsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.7]
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function edit(Request $request)
|
||||
{
|
||||
|
@ -61,7 +60,7 @@ class BulkAssetModelsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.7]
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(Request $request)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,6 @@ use App\Http\Requests\ImageUploadRequest;
|
|||
use App\Models\Category as Category;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Str;
|
||||
|
||||
/**
|
||||
* This class controls all actions related to Categories for
|
||||
|
@ -91,7 +90,7 @@ class CategoriesController extends Controller
|
|||
* @see CategoriesController::postEdit() method saves the data
|
||||
* @param int $categoryId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($categoryId = null)
|
||||
|
@ -178,7 +177,7 @@ 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
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
* @since [v1.8]
|
||||
*/
|
||||
|
|
|
@ -81,7 +81,7 @@ final class CompaniesController extends Controller
|
|||
* @author [Abdullah Alansari] [<ahimta@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @param int $companyId
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($companyId)
|
||||
|
|
|
@ -95,7 +95,7 @@ class ComponentCheckinController extends Controller
|
|||
|
||||
$asset = Asset::find($component_assets->asset_id);
|
||||
|
||||
event(new CheckoutableCheckedIn($component, $asset, Auth::user(), $request->input('note'), Carbon::now()));
|
||||
event(new CheckoutableCheckedIn($component, $asset, auth()->user(), $request->input('note'), Carbon::now()));
|
||||
if ($backto == 'asset'){
|
||||
return redirect()->route('hardware.show', $asset->id)->with('success',
|
||||
trans('admin/components/message.checkin.success'));
|
||||
|
|
|
@ -100,14 +100,14 @@ class ComponentCheckoutController extends Controller
|
|||
$component->asset_id = $request->input('asset_id');
|
||||
$component->assets()->attach($component->id, [
|
||||
'component_id' => $component->id,
|
||||
'user_id' => Auth::user(),
|
||||
'user_id' => auth()->user(),
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'assigned_qty' => $request->input('assigned_qty'),
|
||||
'asset_id' => $request->input('asset_id'),
|
||||
'note' => $request->input('note'),
|
||||
]);
|
||||
|
||||
event(new CheckoutableCheckedOut($component, $asset, Auth::user(), $request->input('note')));
|
||||
event(new CheckoutableCheckedOut($component, $asset, auth()->user(), $request->input('note')));
|
||||
|
||||
return redirect()->route('components.index')->with('success', trans('admin/components/message.checkout.success'));
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class ConsumableCheckoutController extends Controller
|
|||
return redirect()->route('consumables.index')->with('error', trans('admin/consumables/message.checkout.unavailable'));
|
||||
}
|
||||
|
||||
$admin_user = Auth::user();
|
||||
$admin_user = auth()->user();
|
||||
$assigned_to = e($request->input('assigned_to'));
|
||||
|
||||
// Check if the user exists
|
||||
|
@ -102,7 +102,7 @@ class ConsumableCheckoutController extends Controller
|
|||
'note' => $request->input('note'),
|
||||
]);
|
||||
}
|
||||
event(new CheckoutableCheckedOut($consumable, $user, Auth::user(), $request->input('note')));
|
||||
event(new CheckoutableCheckedOut($consumable, $user, auth()->user(), $request->input('note')));
|
||||
|
||||
// Redirect to the new consumable page
|
||||
return redirect()->route('consumables.index')->with('success', trans('admin/consumables/message.checkout.success'));
|
||||
|
|
|
@ -35,6 +35,6 @@ abstract class Controller extends BaseController
|
|||
public function __construct()
|
||||
{
|
||||
view()->share('signedIn', Auth::check());
|
||||
view()->share('user', Auth::user());
|
||||
view()->share('user', auth()->user());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class CustomFieldsController extends Controller
|
|||
*
|
||||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @return \Illuminate\Support\Facades\View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function index()
|
||||
|
@ -60,7 +60,7 @@ class CustomFieldsController extends Controller
|
|||
* @see CustomFieldsController::storeField()
|
||||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @return \Illuminate\Support\Facades\View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function create(Request $request)
|
||||
|
@ -202,7 +202,7 @@ class CustomFieldsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $id
|
||||
* @since [v4.0]
|
||||
* @return \Illuminate\Support\Facades\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit(Request $request, $id)
|
||||
|
|
|
@ -34,7 +34,7 @@ class CustomFieldsetsController extends Controller
|
|||
*
|
||||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @param int $id
|
||||
* @return \Illuminate\Support\Facades\View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
* @since [v1.8]
|
||||
*/
|
||||
|
@ -70,7 +70,7 @@ class CustomFieldsetsController extends Controller
|
|||
*
|
||||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @return \Illuminate\Support\Facades\View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function create()
|
||||
|
@ -95,7 +95,7 @@ class CustomFieldsetsController extends Controller
|
|||
|
||||
$fieldset = new CustomFieldset([
|
||||
'name' => $request->get('name'),
|
||||
'user_id' => Auth::user()->id,
|
||||
'user_id' => auth()->id(),
|
||||
]);
|
||||
|
||||
$validator = Validator::make($request->all(), $fieldset->rules);
|
||||
|
@ -175,7 +175,7 @@ class CustomFieldsetsController extends Controller
|
|||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @param int $id
|
||||
* @since [v1.8]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function destroy($id)
|
||||
|
@ -203,7 +203,7 @@ class CustomFieldsetsController extends Controller
|
|||
*
|
||||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @since [v1.8]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function associate(Request $request, $id)
|
||||
{
|
||||
|
|
|
@ -21,12 +21,12 @@ class DashboardController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// Show the page
|
||||
if (Auth::user()->hasAccess('admin')) {
|
||||
if (auth()->user()->hasAccess('admin')) {
|
||||
$asset_stats = null;
|
||||
|
||||
$counts['asset'] = \App\Models\Asset::count();
|
||||
|
@ -34,7 +34,7 @@ class DashboardController extends Controller
|
|||
$counts['license'] = \App\Models\License::assetcount();
|
||||
$counts['consumable'] = \App\Models\Consumable::count();
|
||||
$counts['component'] = \App\Models\Component::count();
|
||||
$counts['user'] = \App\Models\Company::scopeCompanyables(Auth::user())->count();
|
||||
$counts['user'] = \App\Models\Company::scopeCompanyables(auth()->user())->count();
|
||||
$counts['grand_total'] = $counts['asset'] + $counts['accessory'] + $counts['license'] + $counts['consumable'];
|
||||
|
||||
if ((! file_exists(storage_path().'/oauth-private.key')) || (! file_exists(storage_path().'/oauth-public.key'))) {
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Http\Requests\ImageUploadRequest;
|
||||
use App\Models\Department;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
@ -25,7 +26,7 @@ class DepartmentsController extends Controller
|
|||
* @see AssetController::getDatatable() method that generates the JSON response
|
||||
* @since [v4.0]
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Support\Facades\View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function index(Request $request)
|
||||
|
@ -45,7 +46,7 @@ class DepartmentsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v4.0]
|
||||
* @param ImageUploadRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function store(ImageUploadRequest $request)
|
||||
|
@ -53,7 +54,7 @@ class DepartmentsController extends Controller
|
|||
$this->authorize('create', Department::class);
|
||||
$department = new Department;
|
||||
$department->fill($request->all());
|
||||
$department->user_id = Auth::user()->id;
|
||||
$department->user_id = auth()->id();
|
||||
$department->manager_id = ($request->filled('manager_id') ? $request->input('manager_id') : null);
|
||||
$department->location_id = ($request->filled('location_id') ? $request->input('location_id') : null);
|
||||
$department->company_id = ($request->filled('company_id') ? $request->input('company_id') : null);
|
||||
|
@ -73,7 +74,7 @@ class DepartmentsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $id
|
||||
* @since [v4.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function show($id)
|
||||
|
@ -145,7 +146,7 @@ class DepartmentsController extends Controller
|
|||
* @see LocationsController::postCreate() method that validates and stores
|
||||
* @param int $departmentId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($departmentId = null)
|
||||
|
@ -159,6 +160,16 @@ class DepartmentsController extends Controller
|
|||
return view('departments/edit', compact('item'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save updated Department information.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @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)
|
||||
{
|
||||
if (is_null($department = Department::find($id))) {
|
||||
|
|
|
@ -87,7 +87,7 @@ class DepreciationsController extends Controller
|
|||
* @see DepreciationsController::postEdit()
|
||||
* @param int $depreciationId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($depreciationId = null)
|
||||
|
@ -175,7 +175,7 @@ class DepreciationsController extends Controller
|
|||
* @see DepreciationsController::postEdit()
|
||||
* @param int $depreciationId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function show($id)
|
||||
|
|
|
@ -64,7 +64,7 @@ class GroupsController extends Controller
|
|||
$group = new Group();
|
||||
$group->name = $request->input('name');
|
||||
$group->permissions = json_encode($request->input('permission'));
|
||||
$group->created_by = Auth::user()->id;
|
||||
$group->created_by = auth()->id();
|
||||
|
||||
if ($group->save()) {
|
||||
return redirect()->route('groups.index')->with('success', trans('admin/groups/message.success.create'));
|
||||
|
@ -80,7 +80,7 @@ class GroupsController extends Controller
|
|||
* @see GroupsController::postEdit()
|
||||
* @param int $id
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
|
@ -154,7 +154,7 @@ class GroupsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param $id
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @since [v4.0.11]
|
||||
*/
|
||||
public function show($id)
|
||||
|
|
|
@ -5,10 +5,13 @@ namespace App\Http\Controllers;
|
|||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
/**
|
||||
* This controller provide the healthz route for
|
||||
* This controller provide the health route for
|
||||
* the Snipe-IT Asset Management application.
|
||||
*
|
||||
* @version v1.0
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
|
||||
*/
|
||||
class HealthController extends BaseController
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ class CheckoutKitController extends Controller
|
|||
* Show Bulk Checkout Page
|
||||
*
|
||||
* @author [D. Minaev.] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @return View View to checkout
|
||||
* @return \Illuminate\Contracts\View\View View to checkout
|
||||
*/
|
||||
public function showCheckout($kit_id)
|
||||
{
|
||||
|
|
|
@ -73,7 +73,7 @@ class PredefinedKitsController extends Controller
|
|||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @since [v1.0]
|
||||
* @param int $kit_id
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit($kit_id = null)
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ class PredefinedKitsController extends Controller
|
|||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @since [v1.0]
|
||||
* @param int $modelId
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function show($kit_id = null)
|
||||
{
|
||||
|
@ -162,7 +162,7 @@ class PredefinedKitsController extends Controller
|
|||
*
|
||||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @param int $kit_id
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function editModel($kit_id, $model_id)
|
||||
{
|
||||
|
@ -184,7 +184,7 @@ class PredefinedKitsController extends Controller
|
|||
*
|
||||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @param int $modelId
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function updateModel(Request $request, $kit_id, $model_id)
|
||||
{
|
||||
|
@ -214,7 +214,7 @@ class PredefinedKitsController extends Controller
|
|||
*
|
||||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @param int $modelId
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function detachModel($kit_id, $model_id)
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ class PredefinedKitsController extends Controller
|
|||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @param int $kit_id
|
||||
* @param int $license_id
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function editLicense($kit_id, $license_id)
|
||||
{
|
||||
|
@ -262,7 +262,7 @@ class PredefinedKitsController extends Controller
|
|||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @param int $kit_id
|
||||
* @param int $license_id
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function updateLicense(Request $request, $kit_id, $license_id)
|
||||
{
|
||||
|
@ -293,7 +293,7 @@ class PredefinedKitsController extends Controller
|
|||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @param int $kit_id
|
||||
* @param int $license_id
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function detachLicense($kit_id, $license_id)
|
||||
{
|
||||
|
@ -316,7 +316,7 @@ class PredefinedKitsController extends Controller
|
|||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @param int $kit_id
|
||||
* @param int $accessoryId
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function editAccessory($kit_id, $accessory_id)
|
||||
{
|
||||
|
@ -341,7 +341,7 @@ class PredefinedKitsController extends Controller
|
|||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @param int $kit_id
|
||||
* @param int $accessory_id
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function updateAccessory(Request $request, $kit_id, $accessory_id)
|
||||
{
|
||||
|
@ -371,7 +371,7 @@ class PredefinedKitsController extends Controller
|
|||
*
|
||||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @param int $accessory_id
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function detachAccessory($kit_id, $accessory_id)
|
||||
{
|
||||
|
@ -394,7 +394,7 @@ class PredefinedKitsController extends Controller
|
|||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @param int $kit_id
|
||||
* @param int $consumable_id
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function editConsumable($kit_id, $consumable_id)
|
||||
{
|
||||
|
@ -419,7 +419,7 @@ class PredefinedKitsController extends Controller
|
|||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @param int $kit_id
|
||||
* @param int $consumableId
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function updateConsumable(Request $request, $kit_id, $consumable_id)
|
||||
{
|
||||
|
@ -449,7 +449,7 @@ class PredefinedKitsController extends Controller
|
|||
*
|
||||
* @author [D. Minaev] [<dmitriy.minaev.v@gmail.com>]
|
||||
* @param int $consumable_id
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function detachConsumable($kit_id, $consumable_id)
|
||||
{
|
||||
|
|
|
@ -14,8 +14,6 @@ use App\Models\Setting;
|
|||
use App\Models\Supplier;
|
||||
use App\Models\User;
|
||||
use App\View\Label as LabelView;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class LabelsController extends Controller
|
||||
{
|
||||
|
@ -23,7 +21,7 @@ class LabelsController extends Controller
|
|||
* Returns the Label view with test data
|
||||
*
|
||||
* @param string $labelName
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @author Grant Le Roux <grant.leroux+snipe-it@gmail.com>
|
||||
*/
|
||||
public function show(string $labelName)
|
||||
|
@ -96,6 +94,5 @@ class LabelsController extends Controller
|
|||
->with('bulkedit', false)
|
||||
->with('count', 0);
|
||||
|
||||
return redirect()->route('home')->with('error', trans('admin/labels/message.does_not_exist'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ class LicenseCheckinController extends Controller
|
|||
|
||||
// Was the asset updated?
|
||||
if ($licenseSeat->save()) {
|
||||
event(new CheckoutableCheckedIn($licenseSeat, $return_to, Auth::user(), $request->input('notes')));
|
||||
event(new CheckoutableCheckedIn($licenseSeat, $return_to, auth()->user(), $request->input('notes')));
|
||||
|
||||
if ($backTo == 'user') {
|
||||
return redirect()->route('users.show', $return_to->id)->with('success', trans('admin/licenses/message.checkin.success'));
|
||||
|
|
|
@ -119,7 +119,7 @@ class LicenseCheckoutController extends Controller
|
|||
$licenseSeat->assigned_to = $target->assigned_to;
|
||||
}
|
||||
if ($licenseSeat->save()) {
|
||||
event(new CheckoutableCheckedOut($licenseSeat, $target, Auth::user(), request('notes')));
|
||||
event(new CheckoutableCheckedOut($licenseSeat, $target, auth()->user(), request('notes')));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ class LicenseCheckoutController extends Controller
|
|||
$licenseSeat->assigned_to = request('assigned_to');
|
||||
|
||||
if ($licenseSeat->save()) {
|
||||
event(new CheckoutableCheckedOut($licenseSeat, $target, Auth::user(), request('notes')));
|
||||
event(new CheckoutableCheckedOut($licenseSeat, $target, auth()->user(), request('notes')));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class LocationsController extends Controller
|
|||
* @see LocationsController::postCreate() method that validates and stores
|
||||
* @param int $locationId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($locationId = null)
|
||||
|
@ -202,7 +202,7 @@ class LocationsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $id
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function show($id = null)
|
||||
{
|
||||
|
@ -240,7 +240,7 @@ class LocationsController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $locationId
|
||||
* @since [v6.0.14]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function getClone($locationId = null)
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ class LocationsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v6.3.1]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postBulkDelete(Request $request)
|
||||
{
|
||||
|
|
|
@ -92,7 +92,7 @@ class ManufacturersController extends Controller
|
|||
* @see ManufacturersController::update()
|
||||
* @param int $manufacturerId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($manufacturerId = null)
|
||||
|
@ -197,7 +197,7 @@ class ManufacturersController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @param int $manufacturerId
|
||||
* @since [v1.0]
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function show($manufacturerId = null)
|
||||
|
@ -238,7 +238,7 @@ class ManufacturersController extends Controller
|
|||
$logaction->item_type = Manufacturer::class;
|
||||
$logaction->item_id = $manufacturer->id;
|
||||
$logaction->created_at = date('Y-m-d H:i:s');
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->user_id = auth()->id();
|
||||
$logaction->logaction('restore');
|
||||
|
||||
// Redirect them to the deleted page if there are more, otherwise the section index
|
||||
|
|
|
@ -15,7 +15,7 @@ class ModalController extends Controller
|
|||
* @version v5.3.7-pre
|
||||
* @author [Brady Wetherington] [<uberbrady@gmail.com>]
|
||||
* @author [A. Gianotto] [<snipe@snipe.net]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function show ($type, $itemId = null) {
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class ProfileController extends Controller
|
|||
public function getIndex()
|
||||
{
|
||||
$this->authorize('self.profile');
|
||||
$user = Auth::user();
|
||||
$user = auth()->user();
|
||||
return view('account/profile', compact('user'));
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ class ProfileController extends Controller
|
|||
public function postIndex(ImageUploadRequest $request)
|
||||
{
|
||||
$this->authorize('self.profile');
|
||||
$user = Auth::user();
|
||||
$user = auth()->user();
|
||||
$user->first_name = $request->input('first_name');
|
||||
$user->last_name = $request->input('last_name');
|
||||
$user->website = $request->input('website');
|
||||
|
@ -97,11 +97,11 @@ class ProfileController extends Controller
|
|||
/**
|
||||
* User change email page.
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function password()
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user = auth()->user();
|
||||
|
||||
return view('account/change-password', compact('user'));
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ class ProfileController extends Controller
|
|||
return redirect()->route('account.password.index')->with('error', trans('admin/users/table.lock_passwords'));
|
||||
}
|
||||
|
||||
$user = Auth::user();
|
||||
$user = auth()->user();
|
||||
if ($user->ldap_import == '1') {
|
||||
return redirect()->route('account.password.index')->with('error', trans('admin/users/message.error.password_ldap'));
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ class ProfileController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v4.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getMenuState(Request $request)
|
||||
{
|
||||
|
@ -199,10 +199,10 @@ class ProfileController extends Controller
|
|||
*/
|
||||
public function printInventory()
|
||||
{
|
||||
$show_user = Auth::user();
|
||||
$show_user = auth()->user();
|
||||
|
||||
return view('users/print')
|
||||
->with('assets', Auth::user()->assets)
|
||||
->with('assets', auth()->user()->assets)
|
||||
->with('licenses', $show_user->licenses()->get())
|
||||
->with('accessories', $show_user->accessories()->get())
|
||||
->with('consumables', $show_user->consumables()->get())
|
||||
|
@ -220,7 +220,7 @@ class ProfileController extends Controller
|
|||
public function emailAssetList()
|
||||
{
|
||||
|
||||
if (!$user = User::find(Auth::user()->id)) {
|
||||
if (!$user = User::find(auth()->id())) {
|
||||
return redirect()->back()
|
||||
->with('error', trans('admin/users/message.user_not_found', ['id' => $id]));
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class ReportsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getAccessoryReport()
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ class ReportsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getDeprecationReport()
|
||||
{
|
||||
|
@ -197,7 +197,7 @@ class ReportsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v4.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function audit()
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ class ReportsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getActivityReport()
|
||||
{
|
||||
|
@ -328,7 +328,7 @@ class ReportsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getLicenseReport()
|
||||
{
|
||||
|
@ -1015,7 +1015,7 @@ class ReportsController extends Controller
|
|||
/**
|
||||
* getImprovementsReport
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @author Vincent Sposato <vincent.sposato@gmail.com>
|
||||
* @version v1.0
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,7 @@ use Illuminate\Http\Request;
|
|||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Redirect;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
@ -47,7 +47,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v3.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\Response
|
||||
*/
|
||||
public function getSetupIndex()
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v3.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getSetupUser()
|
||||
{
|
||||
|
@ -231,7 +231,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v3.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getSetupDone()
|
||||
{
|
||||
|
@ -248,7 +248,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v3.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getSetupMigrate()
|
||||
{
|
||||
|
@ -271,7 +271,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
@ -287,7 +287,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getEdit()
|
||||
{
|
||||
|
@ -303,7 +303,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getSettings()
|
||||
{
|
||||
|
@ -319,7 +319,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postSettings(Request $request)
|
||||
{
|
||||
|
@ -376,7 +376,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getBranding()
|
||||
{
|
||||
|
@ -494,7 +494,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getSecurity()
|
||||
{
|
||||
|
@ -510,7 +510,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postSecurity(Request $request)
|
||||
{
|
||||
|
@ -568,7 +568,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getLocalization()
|
||||
{
|
||||
|
@ -584,7 +584,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postLocalization(Request $request)
|
||||
{
|
||||
|
@ -616,7 +616,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getAlerts()
|
||||
{
|
||||
|
@ -632,7 +632,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postAlerts(Request $request)
|
||||
{
|
||||
|
@ -689,7 +689,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getSlack()
|
||||
{
|
||||
|
@ -705,7 +705,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getAssetTags()
|
||||
{
|
||||
|
@ -721,7 +721,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postAssetTags(Request $request)
|
||||
{
|
||||
|
@ -749,7 +749,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getBarcodes()
|
||||
{
|
||||
|
@ -766,7 +766,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postBarcodes(Request $request)
|
||||
{
|
||||
|
@ -795,7 +795,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v4.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function getPhpInfo()
|
||||
{
|
||||
|
@ -814,7 +814,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v4.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getLabels()
|
||||
{
|
||||
|
@ -830,7 +830,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v4.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postLabels(Request $request)
|
||||
{
|
||||
|
@ -907,7 +907,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v4.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getLdapSettings()
|
||||
{
|
||||
|
@ -942,7 +942,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v4.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postLdapSettings(Request $request)
|
||||
{
|
||||
|
@ -1001,7 +1001,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since v5.0.0
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getSamlSettings()
|
||||
{
|
||||
|
@ -1017,7 +1017,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since v5.0.0
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postSamlSettings(SettingsSamlRequest $request)
|
||||
{
|
||||
|
@ -1061,7 +1061,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v6.1.1]
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getGoogleLoginSettings()
|
||||
{
|
||||
|
@ -1074,7 +1074,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v6.1.1]
|
||||
* @return View
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postGoogleLoginSettings(Request $request)
|
||||
{
|
||||
|
@ -1104,7 +1104,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.8]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getBackups()
|
||||
{
|
||||
|
@ -1179,7 +1179,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.8]
|
||||
*
|
||||
* @return Storage
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function downloadFile($filename = null)
|
||||
{
|
||||
|
@ -1205,7 +1205,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v1.8]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function deleteFile($filename = null)
|
||||
{
|
||||
|
@ -1231,7 +1231,7 @@ class SettingsController extends Controller
|
|||
}
|
||||
|
||||
// Hell to the no
|
||||
Log::warning('User ID '.Auth::user()->id.' is attempting to delete backup file '.$filename.' and is not authorized to.');
|
||||
Log::warning('User ID '.auth()->id().' is attempting to delete backup file '.$filename.' and is not authorized to.');
|
||||
return redirect()->route('settings.backups.index')->with('error', trans('general.backup_delete_not_allowed'));
|
||||
}
|
||||
|
||||
|
@ -1281,7 +1281,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v6.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postRestore($filename = null)
|
||||
{
|
||||
|
@ -1292,7 +1292,7 @@ class SettingsController extends Controller
|
|||
if (Storage::exists($path.'/'.$filename)) {
|
||||
|
||||
// grab the user's info so we can make sure they exist in the system
|
||||
$user = User::find(Auth::user()->id);
|
||||
$user = User::find(auth()->id());
|
||||
|
||||
// TODO: run a backup
|
||||
|
||||
|
@ -1352,12 +1352,12 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v4.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function getPurge()
|
||||
{
|
||||
|
||||
Log::warning('User '.Auth::user()->username.' (ID'.Auth::user()->id.') is attempting a PURGE');
|
||||
Log::warning('User '.auth()->user()->username.' (ID'.auth()->id().') is attempting a PURGE');
|
||||
|
||||
if (config('app.allow_purge')=='true') {
|
||||
return view('settings.purge-form');
|
||||
|
@ -1373,11 +1373,11 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v3.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postPurge(Request $request)
|
||||
{
|
||||
Log::warning('User '.Auth::user()->username.' (ID'.Auth::user()->id.') is attempting a PURGE');
|
||||
Log::warning('User '.auth()->user()->username.' (ID'.auth()->id().') is attempting a PURGE');
|
||||
|
||||
if (config('app.allow_purge')=='true') {
|
||||
Log::debug('Purging is not allowed via the .env');
|
||||
|
@ -1386,7 +1386,7 @@ class SettingsController extends Controller
|
|||
|
||||
if ($request->input('confirm_purge')=='DELETE') {
|
||||
|
||||
Log::warning('User ID ' . Auth::user()->id . ' initiated a PURGE!');
|
||||
Log::warning('User ID ' . auth()->id() . ' initiated a PURGE!');
|
||||
// Run a backup immediately before processing
|
||||
Artisan::call('backup:run');
|
||||
Artisan::call('snipeit:purge', ['--force' => 'true', '--no-interaction' => true]);
|
||||
|
@ -1404,7 +1404,7 @@ class SettingsController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
Log::error('User '.Auth::user()->username.' (ID'.Auth::user()->id.') is attempting to purge deleted data and is not authorized to.');
|
||||
Log::error('User '.auth()->user()->username.' (ID'.auth()->id().') is attempting to purge deleted data and is not authorized to.');
|
||||
|
||||
|
||||
// Nope.
|
||||
|
@ -1422,7 +1422,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v4.0]
|
||||
*
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function api()
|
||||
{
|
||||
|
@ -1436,7 +1436,7 @@ class SettingsController extends Controller
|
|||
*
|
||||
* @since [v3.0]
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function ajaxTestEmail()
|
||||
{
|
||||
|
@ -1446,12 +1446,21 @@ class SettingsController extends Controller
|
|||
'email' => config('mail.from.address'),
|
||||
])->notify(new MailTest());
|
||||
|
||||
return response()->json(Helper::formatStandardApiResponse('success', null, 'Maiol sent!'));
|
||||
return response()->json(Helper::formatStandardApiResponse('success', null, trans('mail_sent.mail_sent')));
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(Helper::formatStandardApiResponse('success', null, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get login attempts view
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function getLoginAttempts()
|
||||
{
|
||||
return view('settings.logins');
|
||||
|
|
|
@ -96,7 +96,7 @@ class StatuslabelsController extends Controller
|
|||
* Statuslabel update.
|
||||
*
|
||||
* @param int $statuslabelId
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($statuslabelId = null)
|
||||
|
|
|
@ -82,7 +82,7 @@ class SuppliersController extends Controller
|
|||
* Supplier update.
|
||||
*
|
||||
* @param int $supplierId
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function edit($supplierId = null)
|
||||
|
@ -174,7 +174,7 @@ class SuppliersController extends Controller
|
|||
* Get the asset information to present to the supplier view page
|
||||
*
|
||||
* @param null $supplierId
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
|
||||
* @internal param int $assetId
|
||||
*/
|
||||
public function show($supplierId = null)
|
||||
|
|
|
@ -102,7 +102,7 @@ class BulkUsersController extends Controller
|
|||
// Remove the user from any updates.
|
||||
$user_raw_array = array_diff($user_raw_array, [Auth::id()]);
|
||||
$manager_conflict = false;
|
||||
$users = User::whereIn('id', $user_raw_array)->where('id', '!=', Auth::user()->id)->get();
|
||||
$users = User::whereIn('id', $user_raw_array)->where('id', '!=', auth()->id())->get();
|
||||
|
||||
$return_array = [
|
||||
'success' => trans('admin/users/message.success.update_bulk'),
|
||||
|
@ -318,7 +318,7 @@ class BulkUsersController extends Controller
|
|||
// Get the users
|
||||
$merge_into_user = User::find($request->input('merge_into_id'));
|
||||
$users_to_merge = User::whereIn('id', $user_ids_to_merge)->with('assets', 'manager', 'userlog', 'licenses', 'consumables', 'accessories', 'managedLocations','uploads', 'acceptances')->get();
|
||||
$admin = User::find(Auth::user()->id);
|
||||
$admin = User::find(auth()->id());
|
||||
|
||||
// Walk users
|
||||
foreach ($users_to_merge as $user_to_merge) {
|
||||
|
|
|
@ -117,7 +117,7 @@ class UsersController extends Controller
|
|||
$user->zip = $request->input('zip', null);
|
||||
$user->remote = $request->input('remote', 0);
|
||||
$user->website = $request->input('website', null);
|
||||
$user->created_by = Auth::user()->id;
|
||||
$user->created_by = auth()->id();
|
||||
$user->start_date = $request->input('start_date', null);
|
||||
$user->end_date = $request->input('end_date', null);
|
||||
$user->autoassign_licenses = $request->input('autoassign_licenses', 0);
|
||||
|
@ -125,7 +125,7 @@ class UsersController extends Controller
|
|||
// Strip out the superuser permission if the user isn't a superadmin
|
||||
$permissions_array = $request->input('permission');
|
||||
|
||||
if (! Auth::user()->isSuperUser()) {
|
||||
if (! auth()->user()->isSuperUser()) {
|
||||
unset($permissions_array['superuser']);
|
||||
}
|
||||
$user->permissions = json_encode($permissions_array);
|
||||
|
@ -176,7 +176,7 @@ class UsersController extends Controller
|
|||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v1.0]
|
||||
* @param $permissions
|
||||
* @return View
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @internal param int $id
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
|
@ -246,7 +246,7 @@ class UsersController extends Controller
|
|||
}
|
||||
|
||||
// Only save groups if the user is a superuser
|
||||
if (Auth::user()->isSuperUser()) {
|
||||
if (auth()->user()->isSuperUser()) {
|
||||
$user->groups()->sync($request->input('groups'));
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ class UsersController extends Controller
|
|||
|
||||
|
||||
// Strip out the superuser permission if the user isn't a superadmin
|
||||
if (! Auth::user()->isSuperUser()) {
|
||||
if (! auth()->user()->isSuperUser()) {
|
||||
unset($permissions_array['superuser']);
|
||||
$permissions_array['superuser'] = $orig_superuser;
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ class UsersController extends Controller
|
|||
$logaction->item_type = User::class;
|
||||
$logaction->item_id = $user->id;
|
||||
$logaction->created_at = date('Y-m-d H:i:s');
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->user_id = auth()->id();
|
||||
$logaction->logaction('restore');
|
||||
|
||||
// Redirect them to the deleted page if there are more, otherwise the section index
|
||||
|
|
|
@ -36,7 +36,7 @@ class ViewAssetsController extends Controller
|
|||
'consumables',
|
||||
'accessories',
|
||||
'licenses',
|
||||
)->find(Auth::user()->id);
|
||||
)->find(auth()->id());
|
||||
|
||||
$field_array = array();
|
||||
|
||||
|
@ -92,7 +92,7 @@ class ViewAssetsController extends Controller
|
|||
}
|
||||
$item = call_user_func([$fullItemType, 'find'], $itemId);
|
||||
|
||||
$user = Auth::user();
|
||||
$user = auth()->user();
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->item_id = $data['asset_id'] = $item->id;
|
||||
|
@ -102,14 +102,15 @@ class ViewAssetsController extends Controller
|
|||
if ($user->location_id) {
|
||||
$logaction->location_id = $user->location_id;
|
||||
}
|
||||
$logaction->target_id = $data['user_id'] = Auth::user()->id;
|
||||
|
||||
$logaction->target_id = $data['user_id'] = auth()->id();
|
||||
$logaction->target_type = User::class;
|
||||
|
||||
$data['item_quantity'] = $request->has('request-quantity') ? e($request->input('request-quantity')) : 1;
|
||||
$data['requested_by'] = $user->present()->fullName();
|
||||
$data['item'] = $item;
|
||||
$data['item_type'] = $itemType;
|
||||
$data['target'] = Auth::user();
|
||||
$data['target'] = auth()->user();
|
||||
|
||||
if ($fullItemType == Asset::class) {
|
||||
$data['item_url'] = route('hardware.show', $item->id);
|
||||
|
@ -147,7 +148,7 @@ class ViewAssetsController extends Controller
|
|||
*/
|
||||
public function getRequestAsset($assetId = null)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user = auth()->user();
|
||||
|
||||
// Check if the asset exists and is requestable
|
||||
if (is_null($asset = Asset::RequestableAssets()->find($assetId))) {
|
||||
|
@ -160,7 +161,7 @@ class ViewAssetsController extends Controller
|
|||
}
|
||||
|
||||
$data['item'] = $asset;
|
||||
$data['target'] = Auth::user();
|
||||
$data['target'] = auth()->user();
|
||||
$data['item_quantity'] = 1;
|
||||
$settings = Setting::getSettings();
|
||||
|
||||
|
@ -172,11 +173,11 @@ class ViewAssetsController extends Controller
|
|||
if ($user->location_id) {
|
||||
$logaction->location_id = $user->location_id;
|
||||
}
|
||||
$logaction->target_id = $data['user_id'] = Auth::user()->id;
|
||||
$logaction->target_id = $data['user_id'] = auth()->id();
|
||||
$logaction->target_type = User::class;
|
||||
|
||||
// If it's already requested, cancel the request.
|
||||
if ($asset->isRequestedBy(Auth::user())) {
|
||||
if ($asset->isRequestedBy(auth()->user())) {
|
||||
$asset->cancelRequest();
|
||||
$asset->decrement('requests_counter', 1);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class CheckForDebug
|
|||
{
|
||||
view()->share('debug_in_production', false);
|
||||
|
||||
if (((Auth::check() && (Auth::user()->isSuperUser()))) && (app()->environment() == 'production') && (config('app.warn_debug') === true) && (config('app.debug') === true)) {
|
||||
if (((Auth::check() && (auth()->user()->isSuperUser()))) && (app()->environment() == 'production') && (config('app.warn_debug') === true) && (config('app.debug') === true)) {
|
||||
view()->share('debug_in_production', true);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,17 +38,17 @@ class CheckForTwoFactor
|
|||
if ($settings = Setting::getSettings()) {
|
||||
if (Auth::check() && ($settings->two_factor_enabled != '')) {
|
||||
// This user is already 2fa-authed
|
||||
if ($request->session()->get('2fa_authed')==Auth::user()->id) {
|
||||
if ($request->session()->get('2fa_authed')==auth()->id()) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
// Two-factor is optional and the user has NOT opted in, let them through
|
||||
if (($settings->two_factor_enabled == '1') && (Auth::user()->two_factor_optin != '1')) {
|
||||
if (($settings->two_factor_enabled == '1') && (auth()->user()->two_factor_optin != '1')) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
// Otherwise make sure they're enrolled and show them the 2FA code screen
|
||||
if ((Auth::user()->two_factor_secret != '') && (Auth::user()->two_factor_enrolled == '1')) {
|
||||
if ((auth()->user()->two_factor_secret != '') && (auth()->user()->two_factor_enrolled == '1')) {
|
||||
return redirect()->route('two-factor')->with('info', trans('auth/message.two_factor.enter_two_factor_code'));
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class DeleteUserRequest extends FormRequest
|
|||
if ($user_to_delete) {
|
||||
$this->merge([
|
||||
'user' => request()->route('user'),
|
||||
'admin_id' => Auth::user()->id,
|
||||
'admin_id' => auth()->id(),
|
||||
'managed_users' => $user_to_delete->managesUsers()->count(),
|
||||
'managed_locations' => $user_to_delete->managedLocations()->count(),
|
||||
'assigned_assets' => $user_to_delete->assets()->count(),
|
||||
|
@ -48,7 +48,7 @@ class DeleteUserRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'user' => Rule::notIn([auth()->user()->id]),
|
||||
'user' => Rule::notIn([auth()->id()]),
|
||||
'managed_users' => Rule::in([0]),
|
||||
'managed_locations' => Rule::in([0]),
|
||||
'assigned_assets' => Rule::in([0]),
|
||||
|
|
|
@ -231,7 +231,7 @@ class AssetsTransformer
|
|||
'expected_checkin' => Helper::getFormattedDateObject($asset->expected_checkin, 'date'),
|
||||
'location' => ($asset->location) ? e($asset->location->name) : null,
|
||||
'status'=> ($asset->assetstatus) ? $asset->present()->statusMeta : null,
|
||||
'assigned_to_self' => ($asset->assigned_to == \Auth::user()->id),
|
||||
'assigned_to_self' => ($asset->assigned_to == auth()->id()),
|
||||
];
|
||||
|
||||
if (($asset->model) && ($asset->model->fieldset) && ($asset->model->fieldset->fields->count() > 0)) {
|
||||
|
@ -258,8 +258,8 @@ class AssetsTransformer
|
|||
|
||||
|
||||
$permissions_array['available_actions'] = [
|
||||
'cancel' => ($asset->isRequestedBy(\Auth::user())) ? true : false,
|
||||
'request' => ($asset->isRequestedBy(\Auth::user())) ? false : true,
|
||||
'cancel' => ($asset->isRequestedBy(auth()->user())) ? true : false,
|
||||
'request' => ($asset->isRequestedBy(auth()->user())) ? false : true,
|
||||
];
|
||||
|
||||
$array += $permissions_array;
|
||||
|
|
|
@ -184,7 +184,7 @@ class AssetImporter extends ItemImporter
|
|||
if (isset($target) && ($target !== false)) {
|
||||
if (!is_null($asset->assigned_to)){
|
||||
if ($asset->assigned_to != $target->id) {
|
||||
event(new CheckoutableCheckedIn($asset, User::find($asset->assigned_to), Auth::user(), 'Checkin from CSV Importer', $checkin_date));
|
||||
event(new CheckoutableCheckedIn($asset, User::find($asset->assigned_to), auth()->user(), 'Checkin from CSV Importer', $checkin_date));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ class LocationImporter extends ItemImporter
|
|||
$this->item['ldap_ou'] = trim($this->findCsvMatch($row, 'ldap_ou'));
|
||||
$this->item['manager'] = trim($this->findCsvMatch($row, 'manager'));
|
||||
$this->item['manager_username'] = trim($this->findCsvMatch($row, 'manager_username'));
|
||||
$this->item['user_id'] = \Auth::user()->id;
|
||||
$this->item['user_id'] = auth()->id();
|
||||
|
||||
if ($this->findCsvMatch($row, 'parent_location')) {
|
||||
$this->item['parent_id'] = $this->createOrFetchLocation(trim($this->findCsvMatch($row, 'parent_location')));
|
||||
|
|
|
@ -69,9 +69,9 @@ class CheckoutableListener
|
|||
}
|
||||
}
|
||||
} catch (ClientException $e) {
|
||||
Log::warning("Exception caught during checkout notification: " . $e->getMessage());
|
||||
Log::debug("Exception caught during checkout notification: " . $e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
Log::warning("Exception caught during checkout notification: " . $e->getMessage());
|
||||
Log::debug("Exception caught during checkout notification: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ class OauthClients extends Component
|
|||
public function render()
|
||||
{
|
||||
return view('livewire.oauth-clients', [
|
||||
'clients' => app(ClientRepository::class)->activeForUser(auth()->user()->id),
|
||||
'authorized_tokens' => app(TokenRepository::class)->forUser(auth()->user()->id)->where('revoked', false),
|
||||
'clients' => app(ClientRepository::class)->activeForUser(auth()->id()),
|
||||
'authorized_tokens' => app(TokenRepository::class)->forUser(auth()->id())->where('revoked', false),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ class OauthClients extends Component
|
|||
]);
|
||||
|
||||
app(ClientRepository::class)->create(
|
||||
auth()->user()->id,
|
||||
auth()->id(),
|
||||
$this->name,
|
||||
$this->redirect,
|
||||
);
|
||||
|
@ -47,10 +47,10 @@ class OauthClients extends Component
|
|||
{
|
||||
// test for safety
|
||||
// ->delete must be of type Client - thus the model binding
|
||||
if ($clientId->user_id == auth()->user()->id) {
|
||||
if ($clientId->user_id == auth()->id()) {
|
||||
app(ClientRepository::class)->delete($clientId);
|
||||
} else {
|
||||
Log::warning('User ' . auth()->user()->id . ' attempted to delete client ' . $clientId->id . ' which belongs to user ' . $clientId->user_id);
|
||||
Log::warning('User ' . auth()->id() . ' attempted to delete client ' . $clientId->id . ' which belongs to user ' . $clientId->user_id);
|
||||
$this->authorizationError = 'You are not authorized to delete this client.';
|
||||
}
|
||||
}
|
||||
|
@ -58,10 +58,10 @@ class OauthClients extends Component
|
|||
public function deleteToken($tokenId): void
|
||||
{
|
||||
$token = app(TokenRepository::class)->find($tokenId);
|
||||
if ($token->user_id == auth()->user()->id) {
|
||||
if ($token->user_id == auth()->id()) {
|
||||
app(TokenRepository::class)->revokeAccessToken($tokenId);
|
||||
} else {
|
||||
Log::warning('User ' . auth()->user()->id . ' attempted to delete token ' . $tokenId . ' which belongs to user ' . $token->user_id);
|
||||
Log::warning('User ' . auth()->id() . ' attempted to delete token ' . $tokenId . ' which belongs to user ' . $token->user_id);
|
||||
$this->authorizationError = 'You are not authorized to delete this token.';
|
||||
}
|
||||
}
|
||||
|
@ -84,12 +84,12 @@ class OauthClients extends Component
|
|||
]);
|
||||
|
||||
$client = app(ClientRepository::class)->find($editClientId->id);
|
||||
if ($client->user_id == auth()->user()->id) {
|
||||
if ($client->user_id == auth()->id()) {
|
||||
$client->name = $this->editName;
|
||||
$client->redirect = $this->editRedirect;
|
||||
$client->save();
|
||||
} else {
|
||||
Log::warning('User ' . auth()->user()->id . ' attempted to edit client ' . $editClientId->id . ' which belongs to user ' . $client->user_id);
|
||||
Log::warning('User ' . auth()->id() . ' attempted to edit client ' . $editClientId->id . ' which belongs to user ' . $client->user_id);
|
||||
$this->authorizationError = 'You are not authorized to edit this client.';
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class PersonalAccessTokens extends Component
|
|||
public function render()
|
||||
{
|
||||
return view('livewire.personal-access-tokens', [
|
||||
'tokens' => Auth::user()->tokens,
|
||||
'tokens' => auth()->user()->tokens,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class PersonalAccessTokens extends Component
|
|||
{
|
||||
$this->validate();
|
||||
|
||||
$newToken = Auth::user()->createToken($this->name);
|
||||
$newToken = auth()->user()->createToken($this->name);
|
||||
|
||||
$this->newTokenString = $newToken->accessToken;
|
||||
|
||||
|
@ -49,6 +49,6 @@ class PersonalAccessTokens extends Component
|
|||
{
|
||||
//this needs safety (though the scope of auth::user might kind of do it...)
|
||||
//seems like it does, test more
|
||||
Auth::user()->tokens()->find($tokenId)?->delete();
|
||||
auth()->user()->tokens()->find($tokenId)?->delete();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace App\Models;
|
|||
|
||||
use App\Models\Traits\Searchable;
|
||||
use App\Presenters\Presentable;
|
||||
use Carbon;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
@ -81,14 +81,14 @@ class Actionlog extends SnipeModel
|
|||
parent::boot();
|
||||
static::creating(function (self $actionlog) {
|
||||
// If the admin is a superadmin, let's see if the target instead has a company.
|
||||
if (Auth::user() && Auth::user()->isSuperUser()) {
|
||||
if (auth()->user() && auth()->user()->isSuperUser()) {
|
||||
if ($actionlog->target) {
|
||||
$actionlog->company_id = $actionlog->target->company_id;
|
||||
} elseif ($actionlog->item) {
|
||||
$actionlog->company_id = $actionlog->item->company_id;
|
||||
}
|
||||
} elseif (Auth::user() && Auth::user()->company) {
|
||||
$actionlog->company_id = Auth::user()->company_id;
|
||||
} elseif (auth()->user() && auth()->user()->company) {
|
||||
$actionlog->company_id = auth()->user()->company_id;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -369,7 +369,7 @@ class Asset extends Depreciable
|
|||
} elseif (get_class($admin) === \App\Models\User::class) {
|
||||
$checkedOutBy = $admin;
|
||||
} else {
|
||||
$checkedOutBy = Auth::user();
|
||||
$checkedOutBy = auth()->user();
|
||||
}
|
||||
event(new CheckoutableCheckedOut($this, $target, $checkedOutBy, $note, $originalValues));
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ final class Company extends SnipeModel
|
|||
if (! static::isFullMultipleCompanySupportEnabled()) {
|
||||
return static::getIdFromInput($unescaped_input);
|
||||
} else {
|
||||
$current_user = Auth::user();
|
||||
$current_user = auth()->user();
|
||||
|
||||
// Super users should be able to set a company to whatever they need
|
||||
if ($current_user->isSuperUser()) {
|
||||
|
@ -157,24 +157,24 @@ final class Company extends SnipeModel
|
|||
}
|
||||
|
||||
|
||||
if (Auth::user()) {
|
||||
if (auth()->user()) {
|
||||
Log::warning('Companyable is '.$companyable);
|
||||
$current_user_company_id = Auth::user()->company_id;
|
||||
$current_user_company_id = auth()->user()->company_id;
|
||||
$companyable_company_id = $companyable->company_id;
|
||||
return $current_user_company_id == null || $current_user_company_id == $companyable_company_id || Auth::user()->isSuperUser();
|
||||
return $current_user_company_id == null || $current_user_company_id == $companyable_company_id || auth()->user()->isSuperUser();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function isCurrentUserAuthorized()
|
||||
{
|
||||
return (! static::isFullMultipleCompanySupportEnabled()) || (Auth::user()->isSuperUser());
|
||||
return (! static::isFullMultipleCompanySupportEnabled()) || (auth()->user()->isSuperUser());
|
||||
}
|
||||
|
||||
public static function canManageUsersCompanies()
|
||||
{
|
||||
return ! static::isFullMultipleCompanySupportEnabled() || Auth::user()->isSuperUser() ||
|
||||
Auth::user()->company_id == null;
|
||||
return ! static::isFullMultipleCompanySupportEnabled() || auth()->user()->isSuperUser() ||
|
||||
auth()->user()->company_id == null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -200,7 +200,7 @@ final class Company extends SnipeModel
|
|||
*/
|
||||
public static function getIdForUser($unescaped_input)
|
||||
{
|
||||
if (! static::isFullMultipleCompanySupportEnabled() || Auth::user()->isSuperUser()) {
|
||||
if (! static::isFullMultipleCompanySupportEnabled() || auth()->user()->isSuperUser()) {
|
||||
return static::getIdFromInput($unescaped_input);
|
||||
} else {
|
||||
return static::getIdForCurrentUser($unescaped_input);
|
||||
|
@ -259,7 +259,7 @@ final class Company extends SnipeModel
|
|||
public static function scopeCompanyables($query, $column = 'company_id', $table_name = null)
|
||||
{
|
||||
// If not logged in and hitting this, assume we are on the command line and don't scope?'
|
||||
if (! static::isFullMultipleCompanySupportEnabled() || (Auth::hasUser() && Auth::user()->isSuperUser()) || (! Auth::hasUser())) {
|
||||
if (! static::isFullMultipleCompanySupportEnabled() || (Auth::hasUser() && auth()->user()->isSuperUser()) || (! Auth::hasUser())) {
|
||||
return $query;
|
||||
} else {
|
||||
return static::scopeCompanyablesDirectly($query, $column, $table_name);
|
||||
|
@ -277,7 +277,7 @@ final class Company extends SnipeModel
|
|||
|
||||
// Get the company ID of the logged-in user, or set it to null if there is no company associated with the user
|
||||
if (Auth::hasUser()) {
|
||||
$company_id = Auth::user()->company_id;
|
||||
$company_id = auth()->user()->company_id;
|
||||
} else {
|
||||
$company_id = null;
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ final class Company extends SnipeModel
|
|||
|
||||
if (count($companyable_names) == 0) {
|
||||
throw new Exception('No Companyable Children to scope');
|
||||
} elseif (! static::isFullMultipleCompanySupportEnabled() || (Auth::hasUser() && Auth::user()->isSuperUser())) {
|
||||
} elseif (! static::isFullMultipleCompanySupportEnabled() || (Auth::hasUser() && auth()->user()->isSuperUser())) {
|
||||
return $query;
|
||||
} else {
|
||||
$f = function ($q) {
|
||||
|
|
|
@ -36,8 +36,8 @@ trait Loggable
|
|||
{
|
||||
$log = new Actionlog;
|
||||
$log = $this->determineLogItemType($log);
|
||||
if (Auth::user()) {
|
||||
$log->user_id = Auth::user()->id;
|
||||
if (auth()->user()) {
|
||||
$log->user_id = auth()->id();
|
||||
}
|
||||
|
||||
if (! isset($target)) {
|
||||
|
@ -148,8 +148,8 @@ trait Loggable
|
|||
$log->action_date = date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
if (Auth::user()) {
|
||||
$log->user_id = Auth::user()->id;
|
||||
if (auth()->user()) {
|
||||
$log->user_id = auth()->id();
|
||||
}
|
||||
|
||||
$changed = [];
|
||||
|
@ -225,7 +225,7 @@ trait Loggable
|
|||
}
|
||||
$log->location_id = ($location_id) ? $location_id : null;
|
||||
$log->note = $note;
|
||||
$log->user_id = Auth::user()->id;
|
||||
$log->user_id = auth()->id();
|
||||
$log->filename = $filename;
|
||||
$log->logaction('audit');
|
||||
|
||||
|
@ -249,8 +249,8 @@ trait Loggable
|
|||
public function logCreate($note = null)
|
||||
{
|
||||
$user_id = -1;
|
||||
if (Auth::user()) {
|
||||
$user_id = Auth::user()->id;
|
||||
if (auth()->user()) {
|
||||
$user_id = auth()->id();
|
||||
}
|
||||
$log = new Actionlog;
|
||||
if (static::class == LicenseSeat::class) {
|
||||
|
@ -284,7 +284,7 @@ trait Loggable
|
|||
$log->item_type = static::class;
|
||||
$log->item_id = $this->id;
|
||||
}
|
||||
$log->user_id = Auth::user()->id;
|
||||
$log->user_id = auth()->id();
|
||||
$log->note = $note;
|
||||
$log->target_id = null;
|
||||
$log->created_at = date('Y-m-d H:i:s');
|
||||
|
|
|
@ -54,7 +54,7 @@ class PredefinedKitCheckoutService
|
|||
$expected_checkin = $request->get('expected_checkin');
|
||||
}
|
||||
|
||||
$admin = Auth::user();
|
||||
$admin = auth()->user();
|
||||
|
||||
$note = e($request->get('note'));
|
||||
|
||||
|
|
|
@ -178,4 +178,32 @@ class CategoryFactory extends Factory
|
|||
'category_type' => 'accessory',
|
||||
]);
|
||||
}
|
||||
|
||||
public function forAssets()
|
||||
{
|
||||
return $this->state([
|
||||
'category_type' => 'asset',
|
||||
]);
|
||||
}
|
||||
|
||||
public function forLicenses()
|
||||
{
|
||||
return $this->state([
|
||||
'category_type' => 'license',
|
||||
]);
|
||||
}
|
||||
|
||||
public function forComponents()
|
||||
{
|
||||
return $this->state([
|
||||
'category_type' => 'component',
|
||||
]);
|
||||
}
|
||||
|
||||
public function forConsumables()
|
||||
{
|
||||
return $this->state([
|
||||
'category_type' => 'consumable',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,4 +90,5 @@ return [
|
|||
'welcome_to' => 'Welcome to :web!',
|
||||
'your_assets' => 'View Your Assets',
|
||||
'your_credentials' => 'Your Snipe-IT credentials',
|
||||
'mail_sent' => 'Mail sent successfully!',
|
||||
];
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
</div>
|
||||
{!! $errors->first($fieldname, '<div class="col-md-8 col-md-offset-3"><span class="alert-msg"><i class="fas fa-times"></i> :message</span></div>') !!}
|
||||
|
||||
{!! $errors->first($fieldname, '<div class="col-md-8 col-md-offset-3"><span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span></div>') !!}
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
|
Loading…
Reference in a new issue