Initial import of animal_management module

This commit is contained in:
Kelin Rescue Hub
2026-04-04 13:13:00 -04:00
commit 20adb1bd1e
65 changed files with 14004 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace humhub\modules\animal_management\models;
use humhub\components\ActiveRecord;
class AnimalGalleryLink extends ActiveRecord
{
public static function tableName()
{
return 'rescue_animal_gallery_link';
}
public function rules()
{
return [
[['animal_id', 'gallery_id', 'contentcontainer_id'], 'required'],
[['animal_id', 'gallery_id', 'contentcontainer_id'], 'integer'],
[['animal_id'], 'unique'],
[['gallery_id'], 'unique'],
];
}
public function beforeSave($insert)
{
if (!parent::beforeSave($insert)) {
return false;
}
$now = date('Y-m-d H:i:s');
if ($insert && empty($this->created_at)) {
$this->created_at = $now;
}
$this->updated_at = $now;
return true;
}
public function getAnimal()
{
return $this->hasOne(Animal::class, ['id' => 'animal_id']);
}
}