This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
dogstats/web/models/Dog.model.php
Chris 12c11b65ba
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
doggo upload
2023-10-26 13:46:55 +02:00

33 lines
996 B
PHP

<?php
class Dog extends Model
{
protected $dbTable = "dogs";
protected $dbFields = array(
'uuid' => ['type' => 'text', 'required', 'unique', 'autoValMethod' => 'gen_ulid'],
'registered' => ['type' => 'datetime', 'required', 'unique', 'autoValMethod' => 'getDateTime'],
'name' => ['type' => 'text'],
'kennel_name' => ['type' => 'text'],
'breed' => ['type' => 'text'],
'size' => ['type' => 'text'], //in cm
'birthday' => ['type' => 'text'],
'agility_size' => ['type' => 'text'], //S,M,I,L
'photo' => ['type' => 'text'],
'active' => ['type' => 'int', 'default' => 1]
);
function isMyDog($dog = false)
{
if ($dog == false)
$dog = $this->id;
if (!$this->exists($dog))
return false;
else {
if (in_array($dog, $_SESSION['user']->data['dogs']))
return true;
else return false;
}
}
}