3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-03-29 20:04:21 +00:00

Change ->has() to ->filled()

This commit is contained in:
snipe
2019-05-23 17:39:50 -07:00
parent 8db2470ac4
commit 2d036c64e9
29 changed files with 148 additions and 148 deletions

View File

@ -71,7 +71,7 @@ class AssetsController extends Controller
public function index(Request $request)
{
$this->authorize('index', Asset::class);
if ($request->has('company_id')) {
if ($request->filled('company_id')) {
$company = Company::find($request->input('company_id'));
} else {
$company = null;
@ -96,7 +96,7 @@ class AssetsController extends Controller
->with('item', new Asset)
->with('statuslabel_types', Helper::statusTypeList());
if ($request->has('model_id')) {
if ($request->filled('model_id')) {
$selected_model = AssetModel::find($request->input('model_id'));
$view->with('selected_model', $selected_model);
}
@ -143,7 +143,7 @@ class AssetsController extends Controller
}
// Create the image (if one was chosen.)
if ($request->has('image')) {
if ($request->filled('image')) {
$image = $request->input('image');
// After modification, the image is prefixed by mime info like the following:
@ -313,7 +313,7 @@ class AssetsController extends Controller
$asset->supplier_id = $request->input('supplier_id', null);
// If the box isn't checked, it's not in the request at all.
$asset->requestable = $request->has('requestable');
$asset->requestable = $request->filled('requestable');
$asset->rtd_location_id = $request->input('rtd_location_id', null);
if ($asset->assigned_to=='') {
@ -321,7 +321,7 @@ class AssetsController extends Controller
}
if ($request->has('image_delete')) {
if ($request->filled('image_delete')) {
try {
unlink(public_path().'/uploads/assets/'.$asset->image);
$asset->image = '';
@ -343,7 +343,7 @@ class AssetsController extends Controller
$asset->physical = '1';
// Update the image
if ($request->has('image')) {
if ($request->filled('image')) {
$image = $request->input('image');
// See postCreate for more explaination of the following.
$header = explode(';', $image, 2)[0];