for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Models;
use System\Model;
class UserModel extends Model
{
protected $table = 'users';
public function getTable()
return $this->table;
}
public function users()
return $this->join('
users.id,
users.username,
users.fname,
users.lname,
users.gender,
users.registration,
users.status,
users.img,
address.country,
address.zip,
activity.is_login,
activity.last_login
', $this->table, [['address', 'id', 'user_id'], ['activity', 'id', 'user_id']])->orderBy('users.registration', 'DESC')->fetchAll();
public function user($id)
$exists = $this->exists($id);
if (!$exists) {
return $this->url->notfound();
return $this->hasOne('
users.birthday,
users.email,
users.password,
address.state,
address.city,
address.street,
address.house_number,
address.additional,
activity.last_login,
activity.last_logout
', $this->table, [['address', 'id', 'user_id'], ['activity', 'id', 'user_id']], $id)->fetch();
public function filter($sql, $wheres)
', $this->table, [['address', 'id', 'user_id'], ['activity', 'id', 'user_id']])->where($sql, $wheres)->orderBy('users.registration', 'DESC')->fetchAll();