add Raktár model + crud
This commit is contained in:
34
common/messages/hu/common/warehouse.php
Normal file
34
common/messages/hu/common/warehouse.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Message translations.
|
||||
*
|
||||
* This file is automatically generated by 'yii message' command.
|
||||
* It contains the localizable messages extracted from source code.
|
||||
* You may modify this file by translating the extracted messages.
|
||||
*
|
||||
* Each array element represents the translation (value) of a message (key).
|
||||
* If the value is empty, the message is considered as not translated.
|
||||
* Messages that no longer need translation will have their translations
|
||||
* enclosed between a pair of '@@' marks.
|
||||
*
|
||||
* Message string can be used with plural forms format. Check i18n section
|
||||
* of the guide for details.
|
||||
*
|
||||
* NOTE: this file must be saved in UTF-8 encoding.
|
||||
*/
|
||||
return [
|
||||
'Active' => 'Aktív',
|
||||
'Inactive' => 'Inaktív',
|
||||
'Reset' => '',
|
||||
'Create' => 'Mentés',
|
||||
'Create Warehouse' => 'Új raktár',
|
||||
'Created At' => 'Létrehozás ideje',
|
||||
'Id Warehouse' => 'Azonosító',
|
||||
'Name' => 'Név',
|
||||
'Search' => 'Keresés',
|
||||
'Status' => 'Státusz',
|
||||
'Update' => 'Módosítás',
|
||||
'Update {modelClass}: ' => '{modelClass} módosítása: ',
|
||||
'Updated At' => 'Módosítás ideje',
|
||||
'Warehouses' => 'Raktárak',
|
||||
];
|
||||
86
common/models/Warehouse.php
Normal file
86
common/models/Warehouse.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
|
||||
/**
|
||||
* This is the model class for table "warehouse".
|
||||
*
|
||||
* @property integer $id_warehouse
|
||||
* @property string $name
|
||||
* @property integer $status
|
||||
* @property integer $created_at
|
||||
* @property integer $updated_at
|
||||
*/
|
||||
class Warehouse extends \yii\db\ActiveRecord
|
||||
{
|
||||
const STATUS_DELETED = 0;
|
||||
const STATUS_ACTIVE = 10;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return 'warehouse';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['name', ], 'required'],
|
||||
[['name', ], 'unique'],
|
||||
[['status', ], 'integer'],
|
||||
[['name'], 'string', 'max' => 64]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
[ 'class' => TimestampBehavior::className(),
|
||||
'value' => function(){ return date('Y-m-d H:i' ); }
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'id_warehouse' => Yii::t('common/warehouse', 'Id Warehouse'),
|
||||
'name' => Yii::t('common/warehouse', 'Name'),
|
||||
'status' => Yii::t('common/warehouse', 'Status'),
|
||||
'created_at' => Yii::t('common/warehouse', 'Created At'),
|
||||
'updated_at' => Yii::t('common/warehouse', 'Updated At'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
static function statuses() {
|
||||
return [
|
||||
self::STATUS_ACTIVE => Yii::t('common/warehouse', 'Active'),
|
||||
self::STATUS_DELETED => Yii::t('common/warehouse', 'Inactive'),
|
||||
];
|
||||
}
|
||||
|
||||
public function getStatusHuman(){
|
||||
$result = null;
|
||||
$s = self::statuses($this->status);
|
||||
if ( array_key_exists($this->status, $s)){
|
||||
$result = $s[$this->status];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user