mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
Changed method and scope names
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
9c9f5be6fe
commit
3e559044b2
|
@ -188,7 +188,7 @@ class UsersController extends Controller
|
|||
$users = $users->OrderDepartment($order);
|
||||
break;
|
||||
case 'created_by':
|
||||
$users = $users->OrderAdmin($order);
|
||||
$users = $users->CreatedBy($order);
|
||||
break;
|
||||
case 'company':
|
||||
$users = $users->OrderCompany($order);
|
||||
|
|
|
@ -63,9 +63,9 @@ class UsersTransformer
|
|||
'accessories_count' => (int) $user->accessories_count,
|
||||
'consumables_count' => (int) $user->consumables_count,
|
||||
'company' => ($user->company) ? ['id' => (int) $user->company->id, 'name'=> e($user->company->name)] : null,
|
||||
'created_by' => ($user->adminuser) ? [
|
||||
'id' => (int) $user->adminuser->id,
|
||||
'name'=> e($user->adminuser->present()->fullName),
|
||||
'created_by' => ($user->createdBy) ? [
|
||||
'id' => (int) $user->createdBy->id,
|
||||
'name'=> e($user->createdBy->present()->fullName),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($user->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($user->updated_at, 'datetime'),
|
||||
|
|
|
@ -568,7 +568,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
|||
* @since [v1.0]
|
||||
* @return \Illuminate\Database\Eloquent\Relations\Relation
|
||||
*/
|
||||
public function adminuser()
|
||||
public function createdBy()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\User::class, 'created_by')->withTrashed();
|
||||
}
|
||||
|
@ -705,7 +705,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
|||
*
|
||||
* @return \Illuminate\Database\Query\Builder Modified query builder
|
||||
*/
|
||||
public function scopeOrderAdmin($query, $order)
|
||||
public function scopeCreatedBy($query, $order)
|
||||
{
|
||||
// Left join here, or it will only return results with parents
|
||||
return $query->leftJoin('users as admin_user', 'users.created_by', '=', 'admin_user.id')
|
||||
|
|
|
@ -464,12 +464,12 @@
|
|||
<div class="col-md-9">
|
||||
{{ \App\Helpers\Helper::getFormattedDateObject($user->created_at, 'datetime')['formatted']}}
|
||||
|
||||
@if ($user->adminuser)
|
||||
@if ($user->createdBy)
|
||||
by
|
||||
@if ($user->adminuser->deleted_at=='')
|
||||
<a href="{{ route('users.show', ['user' => $user->user_id]) }}">{{ $user->adminuser->present()->fullName }}</a>
|
||||
@if ($user->createdBy->deleted_at=='')
|
||||
<a href="{{ route('users.show', ['user' => $user->user_id]) }}">{{ $user->createdBy->present()->fullName }}</a>
|
||||
@else
|
||||
<del>{{ $user->adminuser->present()->fullName }}</del>
|
||||
<del>{{ $user->createdBy->present()->fullName }}</del>
|
||||
@endif
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue