mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Use auth()->id() instead of Auth::id()
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
b247fc33b9
commit
822ea96dfd
|
@ -128,7 +128,7 @@ class AssetMaintenancesController extends Controller
|
|||
// create a new model instance
|
||||
$maintenance = new AssetMaintenance();
|
||||
$maintenance->fill($request->all());
|
||||
$maintenance->created_by = Auth::id();
|
||||
$maintenance->created_by = auth()->id();
|
||||
|
||||
// Was the asset maintenance created?
|
||||
if ($maintenance->save()) {
|
||||
|
|
|
@ -81,7 +81,7 @@ class ComponentsController extends Controller
|
|||
$component->purchase_date = $request->input('purchase_date', null);
|
||||
$component->purchase_cost = $request->input('purchase_cost', null);
|
||||
$component->qty = $request->input('qty');
|
||||
$component->created_by = Auth::id();
|
||||
$component->created_by = auth()->id();
|
||||
$component->notes = $request->input('notes');
|
||||
|
||||
$component = $request->handleImages($component);
|
||||
|
|
|
@ -81,7 +81,7 @@ class ConsumablesController extends Controller
|
|||
$consumable->purchase_date = $request->input('purchase_date');
|
||||
$consumable->purchase_cost = $request->input('purchase_cost');
|
||||
$consumable->qty = $request->input('qty');
|
||||
$consumable->created_by = Auth::id();
|
||||
$consumable->created_by = auth()->id();
|
||||
$consumable->notes = $request->input('notes');
|
||||
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ class CustomFieldsController extends Controller
|
|||
"auto_add_to_fieldsets" => $request->get("auto_add_to_fieldsets", 0),
|
||||
"show_in_listview" => $request->get("show_in_listview", 0),
|
||||
"show_in_requestable_list" => $request->get("show_in_requestable_list", 0),
|
||||
"user_id" => Auth::id()
|
||||
"user_id" => auth()->id()
|
||||
]);
|
||||
|
||||
|
||||
|
@ -248,7 +248,7 @@ class CustomFieldsController extends Controller
|
|||
$field->name = trim(e($request->get("name")));
|
||||
$field->element = e($request->get("element"));
|
||||
$field->field_values = $request->get("field_values");
|
||||
$field->created_by = Auth::id();
|
||||
$field->created_by = auth()->id();
|
||||
$field->help_text = $request->get("help_text");
|
||||
$field->show_in_email = $show_in_email;
|
||||
$field->is_unique = $request->get("is_unique", 0);
|
||||
|
|
|
@ -99,7 +99,7 @@ class LicensesController extends Controller
|
|||
$license->supplier_id = $request->input('supplier_id');
|
||||
$license->category_id = $request->input('category_id');
|
||||
$license->termination_date = $request->input('termination_date');
|
||||
$license->created_by = Auth::id();
|
||||
$license->created_by = auth()->id();
|
||||
$license->min_amt = $request->input('min_amt');
|
||||
|
||||
session()->put(['redirect_option' => $request->get('redirect_option')]);
|
||||
|
|
|
@ -101,7 +101,7 @@ class BulkUsersController extends Controller
|
|||
$user_raw_array = $request->input('ids');
|
||||
|
||||
// Remove the user from any updates.
|
||||
$user_raw_array = array_diff($user_raw_array, [Auth::id()]);
|
||||
$user_raw_array = array_diff($user_raw_array, [auth()->id()]);
|
||||
$manager_conflict = false;
|
||||
$users = User::whereIn('id', $user_raw_array)->where('id', '!=', auth()->id())->get();
|
||||
|
||||
|
@ -166,7 +166,7 @@ class BulkUsersController extends Controller
|
|||
}
|
||||
// Save the updated info
|
||||
User::whereIn('id', $user_raw_array)
|
||||
->where('id', '!=', Auth::id())->update($this->update_array);
|
||||
->where('id', '!=', auth()->id())->update($this->update_array);
|
||||
|
||||
if (array_key_exists('location_id', $this->update_array)){
|
||||
Asset::where('assigned_type', User::class)
|
||||
|
@ -228,7 +228,7 @@ class BulkUsersController extends Controller
|
|||
|
||||
$user_raw_array = request('ids');
|
||||
|
||||
if (($key = array_search(Auth::id(), $user_raw_array)) !== false) {
|
||||
if (($key = array_search(auth()->id(), $user_raw_array)) !== false) {
|
||||
unset($user_raw_array[$key]);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class UserFilesController extends Controller
|
|||
$logAction = new Actionlog();
|
||||
$logAction->item_id = $user->id;
|
||||
$logAction->item_type = User::class;
|
||||
$logaction->created_by = Auth::id();
|
||||
$logaction->created_by = auth()->id();
|
||||
$logAction->note = $request->input('notes');
|
||||
$logAction->target_id = null;
|
||||
$logAction->created_at = date("Y-m-d H:i:s");
|
||||
|
|
|
@ -60,7 +60,7 @@ class ItemImportRequest extends FormRequest
|
|||
$fieldMappings = array_change_key_case(array_flip($import->field_map), CASE_LOWER);
|
||||
}
|
||||
$importer->setCallbacks([$this, 'log'], [$this, 'progress'], [$this, 'errorCallback'])
|
||||
->setUserId(Auth::id())
|
||||
->setUserId(auth()->id())
|
||||
->setUpdating($this->get('import-update'))
|
||||
->setShouldNotify($this->get('send-welcome'))
|
||||
->setUsernameFormat('firstname.lastname')
|
||||
|
|
|
@ -64,7 +64,10 @@ class AssetMaintenancesTransformer
|
|||
'start_date' => Helper::getFormattedDateObject($assetmaintenance->start_date, 'date'),
|
||||
'asset_maintenance_time' => $assetmaintenance->asset_maintenance_time,
|
||||
'completion_date' => Helper::getFormattedDateObject($assetmaintenance->completion_date, 'date'),
|
||||
'user_id' => ($assetmaintenance->admin) ? ['id' => $assetmaintenance->admin->id, 'name'=> e($assetmaintenance->admin->getFullNameAttribute())] : null,
|
||||
'user_id' => ($assetmaintenance->adminuser) ? [
|
||||
'id' => $assetmaintenance->adminuser->id,
|
||||
'name'=> e($assetmaintenance->admin->getFullNameAttribute())
|
||||
] : null, // legacy to not change the shape of the API
|
||||
'created_by' => ($assetmaintenance->adminuser) ? [
|
||||
'id' => (int) $assetmaintenance->adminuser->id,
|
||||
'name'=> e($assetmaintenance->adminuser->present()->fullName()),
|
||||
|
|
|
@ -183,7 +183,7 @@ class License extends Depreciable
|
|||
$logAction = new Actionlog;
|
||||
$logAction->item_type = self::class;
|
||||
$logAction->item_id = $license->id;
|
||||
$logAction->created_by = Auth::id() ?: 1; // We don't have an id while running the importer from CLI.
|
||||
$logAction->created_by = auth()->id() ?: 1; // We don't have an id while running the importer from CLI.
|
||||
$logAction->note = "deleted ${change} seats";
|
||||
$logAction->target_id = null;
|
||||
$logAction->logaction('delete seats');
|
||||
|
@ -215,7 +215,7 @@ class License extends Depreciable
|
|||
$logAction = new Actionlog();
|
||||
$logAction->item_type = self::class;
|
||||
$logAction->item_id = $license->id;
|
||||
$logAction->created_by = Auth::id() ?: 1; // Importer.
|
||||
$logAction->created_by = auth()->id() ?: 1; // Importer.
|
||||
$logAction->note = "added ${change} seats";
|
||||
$logAction->target_id = null;
|
||||
$logAction->logaction('add seats');
|
||||
|
|
|
@ -29,19 +29,19 @@ trait Requestable
|
|||
public function request($qty = 1)
|
||||
{
|
||||
$this->requests()->save(
|
||||
new CheckoutRequest(['user_id' => Auth::id(), 'qty' => $qty])
|
||||
new CheckoutRequest(['user_id' => auth()->id(), 'qty' => $qty])
|
||||
);
|
||||
}
|
||||
|
||||
public function deleteRequest()
|
||||
{
|
||||
$this->requests()->where('user_id', Auth::id())->delete();
|
||||
$this->requests()->where('user_id', auth()->id())->delete();
|
||||
}
|
||||
|
||||
public function cancelRequest($user_id = null)
|
||||
{
|
||||
if (!$user_id){
|
||||
$user_id = Auth::id();
|
||||
$user_id = auth()->id();
|
||||
}
|
||||
|
||||
$this->requests()->where('user_id', $user_id)->update(['canceled_at' => \Carbon\Carbon::now()]);
|
||||
|
|
Loading…
Reference in a new issue