oauth2-server/examples/relational/Model/Users.php

26 lines
492 B
PHP
Raw Normal View History

2014-05-09 15:16:59 +05:30
<?php
namespace RelationalExample\Model;
use Illuminate\Database\Capsule\Manager as Capsule;
class Users
{
public function get($username = null)
{
2014-08-04 19:56:26 +05:30
$query = Capsule::table('users')->select(['username', 'password', 'name', 'email', 'photo']);
2014-05-09 15:16:59 +05:30
if ($username !== null) {
$query->where('username', '=', $username);
}
$result = $query->get();
if (count($result) > 0) {
return $result;
}
2014-12-10 18:40:35 +05:30
return;
2014-05-09 15:16:59 +05:30
}
}