<commit_before><?php

namespace app\models;

use Yii;
use \yii\web\UploadedFile;

/**
 * This is the model class for table "company".
 *
 * @property integer $id
 * @property string $CompanyName
 * @property string $Address
 * @property string $contact
 * @property string $Taxation_Number
 */
class Company extends \yii\db\ActiveRecord {

    public $upload_foler = 'uploads/logo';

    /**
     * @inheritdoc
     */
    public static function tableName() {
        return 'company';
    }

    /**
     * @inheritdoc
     */
    public function rules() {
        return [
            [['companyname', 'address', 'contact', 'taxation_number', 'ceo'], 'required'],
            [['companyname', 'address', 'contact'], 'string', 'max' => 150],
            [['ceo'], 'string', 'max' => 100],
            [['taxation_number'],'string','max'=>13,'length'=>13]
            ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels() {
        return [
            'id' => 'ลำดับ',
            'companyname' => 'ชื่อบริษัท',
            'address' => 'ที่อยู่บริษัท',
            'contact' => 'ที่ติดต่อ',
            'taxation_number' => 'เลขผู้เสียภาษีอากร',
            'logo' => 'โลโก้',
            'ceo' => 'รายชื่อผู้ลงนาม ในบิล/ใบแจ้งหนี้/ใบเสร็จ',
        ];
    }

    public function upload($model, $attribute) {
        $photo = UploadedFile::getInstance($model, $attribute);
        $path = $this->getUploadPath();
        if ($this->validate() && $photo !== null) {

            $fileName = md5($photo->baseName . time()) . '.' . $photo->extension;
            //$fileName = $photo->baseName . '.' . $photo->extension;
            if ($photo->saveAs($path . $fileName)) {
                return $fileName;
            }<commit_msg>สร้าง ข้อมูลบริษัท<commit_after><?php

namespace app\models;

use Yii;
use \yii\web\UploadedFile;

/**
 * This is the model class for table "company".
 *
 * @property integer $id
 * @property string $CompanyName
 * @property string $Address
 * @property string $contact
 * @property string $Taxation_Number
 */
class Company extends \yii\db\ActiveRecord {

    public $upload_foler = 'uploads/logo';

    /**
     * @inheritdoc
     */
    public static function tableName() {
        return 'company';
    }

    /**
     * @inheritdoc
     */
    public function rules() {
        return [
            [['companyname', 'address', 'contact', 'taxation_number', 'ceo'], 'required'],
            [['companyname', 'address', 'contact'], 'string', 'max' => 150],
            [['ceo'], 'string', 'max' => 100],
            [['taxation_number'],'string','max'=>13,'length'=>13],
            ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels() {
        return [
            'id' => 'ลำดับ',
            'companyname' => 'ชื่อบริษัท',
            'address' => 'ที่อยู่บริษัท',
            'contact' => 'ที่ติดต่อ',
            'taxation_number' => 'เลขผู้เสียภาษีอากร',
            'logo' => 'โลโก้',
            'ceo' => 'รายชื่อผู้ลงนาม ในบิล/ใบแจ้งหนี้/ใบเสร็จ',
        ];
    }

    public function upload($model, $attribute) {
        $photo = UploadedFile::getInstance($model, $attribute);
        $path = $this->getUploadPath();
        if ($this->validate() && $photo !== null) {

            $fileName = md5($photo->baseName . time()) . '.' . $photo->extension;
            //$fileName = $photo->baseName . '.' . $photo->extension;
            if ($photo->saveAs($path . $fileName)) {
                return $fileName;
            }
{'fraction_non_alphanumeric': 0.19047619047619047, 'fraction_numerical': 0.006235827664399093, 'mean_word_length': 2.1565295169946332, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3903741', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1219, 'n_words': 223}