Skip to content

Instantly share code, notes, and snippets.

@nsanden
Created May 18, 2014 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsanden/262d57b91aa0b6d158a7 to your computer and use it in GitHub Desktop.
Save nsanden/262d57b91aa0b6d158a7 to your computer and use it in GitHub Desktop.
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveRecord;
/**
* This is the model class for table "tbl_job".
*
* @property integer $id
* @property string $title
* @property string $description
* @property string $pay
* @property string $application_name
* @property string $application_url
* @property integer $expired
* @property string $updated
* @property string $created
*/
class Job extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'tbl_job';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['title', 'description', 'pay', 'application_name', 'application_url'], 'required'],
[['description'], 'string'],
[['updated', 'created', 'expired'], 'safe'],
[['title', 'pay'], 'string', 'max' => 255]
];
}
public function behaviors()
{
return [
'timestamp' => [
'class' => TimestampBehavior::className(),
'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => ['created', 'updated'],
ActiveRecord::EVENT_BEFORE_UPDATE => 'updated',
],
],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'title' => 'Title',
'description' => 'Description',
'pay' => 'Pay',
'expired' => 'Expired',
'application_name' => 'Application Name',
'application_url' => 'Application URL',
'updated' => 'Updated',
'created' => 'Created',
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment