75 lines
1.6 KiB
PHP
75 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use Yii;
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\db\Expression;
|
|
|
|
/**
|
|
* This is the model class for table "file".
|
|
*
|
|
* @property int $id
|
|
* @property string $name
|
|
* @property string $path
|
|
* @property string $url
|
|
* @property string $type
|
|
* @property string $mime-type
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
* @property int $status
|
|
*/
|
|
class File extends \yii\db\ActiveRecord
|
|
{
|
|
public function behaviors()
|
|
{
|
|
return [
|
|
[
|
|
'class' => TimestampBehavior::class,
|
|
'createdAtAttribute' => 'created_at',
|
|
'updatedAtAttribute' => 'updated_at',
|
|
'value' => new Expression('NOW()'),
|
|
],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'file';
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['path'], 'string'],
|
|
[['created_at', 'updated_at'], 'safe'],
|
|
[['status'], 'integer'],
|
|
[['name', 'type', 'mime-type', 'url'], 'string', 'max' => 255],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id' => 'ID',
|
|
'name' => 'Name',
|
|
'path' => 'Path',
|
|
'url' => 'URL',
|
|
'type' => 'Type',
|
|
'mime-type' => 'Mime Type',
|
|
'created_at' => 'Created At',
|
|
'updated_at' => 'Updated At',
|
|
'status' => 'Status',
|
|
];
|
|
}
|
|
}
|