This commit is contained in:
2020-03-27 15:55:56 +07:00
parent ead3361d32
commit a4510fce21
13 changed files with 108 additions and 7 deletions

56
models/SyncUrl.php Normal file
View File

@@ -0,0 +1,56 @@
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "sync_url".
*
* @property int $id
* @property string $data
*/
class SyncUrl extends \yii\db\ActiveRecord {
/**
* {@inheritdoc}
*/
public static function tableName() {
return 'sync_url';
}
/**
* {@inheritdoc}
*/
public function rules() {
return [
[['data'], 'required'],
[['data'], 'string'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels() {
return [
'id' => 'ID',
'data' => 'Data',
];
}
public function create($data) {
$r = $this->load([
'data' => $data['url'],
], '');
if ($r) {
try {
$this->save();
return $this->id;
} catch (\Exception $ex) {
return false;
}
}
}
}