Use DaneEveritt's shortened query call.
This commit is contained in:
parent
b5d3417167
commit
3f5bf099ae
1 changed files with 1 additions and 5 deletions
|
@ -75,11 +75,7 @@ class UserController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function view(Request $request, $id)
|
public function view(Request $request, $id)
|
||||||
{
|
{
|
||||||
if(is_numeric($id)) {
|
$query = Models\User::where((is_numeric($id) ? 'id' : 'email'), $id);
|
||||||
$query = Models\User::where('id', $id);
|
|
||||||
} else {
|
|
||||||
$query = Models\User::where('email', $id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! is_null($request->input('fields'))) {
|
if (! is_null($request->input('fields'))) {
|
||||||
foreach (explode(',', $request->input('fields')) as $field) {
|
foreach (explode(',', $request->input('fields')) as $field) {
|
||||||
|
|
Loading…
Reference in a new issue