Skip to content

Commit

Permalink
Fixed dumb indenting
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Nov 4, 2015
1 parent 17207dd commit 6e117ef
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 32 deletions.
4 changes: 2 additions & 2 deletions app/config/version.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
return array (
'app_version' => 'v2.0-382',
'hash_version' => 'v2.0-382-g90513b0',
'app_version' => 'v2.0-384',
'hash_version' => 'v2.0-384-g130b1b4',
);
25 changes: 12 additions & 13 deletions app/controllers/admin/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use Location;
use Log;
use Mail;
use Datatable;
use TCPDF;
use Slack;
use Paginator;
Expand Down Expand Up @@ -1141,18 +1140,18 @@ public function getDatatable($status = null)
}

$allowed_columns = [
'id',
'name',
'asset_tag',
'serial',
'model',
'last_checkout',
'category',
'notes',
'expected_checkin',
'order_number',
'location'
];
'id',
'name',
'asset_tag',
'serial',
'model',
'last_checkout',
'category',
'notes',
'expected_checkin',
'order_number',
'location'
];

$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'asset_tag';
Expand Down
34 changes: 17 additions & 17 deletions app/models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public static function generateFormattedNameFromFullName($format = 'filastname',

}

/**
/**
* Query builder scope to search on text
*
* @param Illuminate\Database\Query\Builder $query Query builder instance
Expand All @@ -211,23 +211,23 @@ public static function generateFormattedNameFromFullName($format = 'filastname',
public function scopeTextsearch($query, $search)
{

return $query->where(function($query) use ($search) {
$query->where('users.first_name', 'LIKE', "%$search%")
->orWhere('users.last_name', 'LIKE', "%$search%")
->orWhere('users.email', 'LIKE', "%$search%")
->orWhere('users.username', 'LIKE', "%$search%")
->orWhere('users.notes', 'LIKE', "%$search%")
->orWhere(function($query) use ($search) {
$query->whereHas('userloc', function($query) use ($search) {
$query->where('name','LIKE','%'.$search.'%');
});
})

// Ugly, ugly code because Laravel sucks at self-joins
->orWhere(function($query) use ($search) {
$query->whereRaw("users.manager_id IN (select id from users where first_name LIKE '%".$search."%' OR last_name LIKE '%".$search."%') ");
});
return $query->where(function($query) use ($search) {
$query->where('users.first_name', 'LIKE', "%$search%")
->orWhere('users.last_name', 'LIKE', "%$search%")
->orWhere('users.email', 'LIKE', "%$search%")
->orWhere('users.username', 'LIKE', "%$search%")
->orWhere('users.notes', 'LIKE', "%$search%")
->orWhere(function($query) use ($search) {
$query->whereHas('userloc', function($query) use ($search) {
$query->where('name','LIKE','%'.$search.'%');
});
})

// Ugly, ugly code because Laravel sucks at self-joins
->orWhere(function($query) use ($search) {
$query->whereRaw("users.manager_id IN (select id from users where first_name LIKE '%".$search."%' OR last_name LIKE '%".$search."%') ");
});
});

}

Expand Down

0 comments on commit 6e117ef

Please sign in to comment.