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

32 lines
956 B
PHP
Raw Normal View History

2023-10-23 14:36:28 +02:00
<?php
2023-10-22 23:05:24 +02:00
2023-10-23 14:36:28 +02:00
class Dog extends Model
{
2023-10-22 23:05:24 +02:00
protected $dbTable = "dogs";
2023-10-23 14:36:28 +02:00
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
'active' => ['type' => 'int', 'default' => 1]
2023-10-22 23:05:24 +02:00
);
2023-10-23 14:36:28 +02:00
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;
}
}
}