/**
  * @inheritdoc
  */
 protected function transformToValue($prop_value)
 {
     if ($prop_value === null) {
         return null;
     }
     return StringHelper::onlyDigits($prop_value);
 }
示例#2
0
 public function actionCreate()
 {
     $model = new Import();
     if ($model->load(Yii::$app->request->post())) {
         $file_path = \yii\web\UploadedFile::getInstance($model, 'file_path');
         if (!empty($file_path)) {
             $model->file_path = \yii\web\UploadedFile::getInstance($model, 'file_path');
             $ext = FileHelper::getExtention($model->file_path);
             if (!empty($ext)) {
                 $fileDir = Yii::$app->controller->module->id . '/' . date('Y/m/d/');
                 $fileName = uniqid() . StringHelper::asUrl(Yii::$app->controller->module->id) . '.' . $ext;
                 $folder = Yii::$app->params['uploadPath'] . '/' . Yii::$app->params['uploadDir'] . '/' . $fileDir;
                 FileHelper::createDirectory($folder);
                 $model->file_path->saveAs($folder . $fileName);
                 $model->file_path = $fileDir . $fileName;
             }
         }
         if ($model->save()) {
             return $this->redirect(['update', 'id' => (string) $model->_id]);
         }
     }
     Yii::$app->view->title = Yii::t($this->module->id, 'Create');
     Yii::$app->view->params['breadcrumbs'][] = ['label' => Yii::t($this->module->id, 'Import'), 'url' => ['index']];
     Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title;
     return $this->render('create', ['model' => $model]);
 }
示例#3
0
文件: User.php 项目: quynhvv/stepup
 public function beforeSave($insert)
 {
     $attributes = array_keys($this->getAttributes());
     // ID
     if ($this->isNewRecord and empty($this->_id)) {
         $this->_id = uniqid();
     }
     // SEO
     if (in_array('title', $attributes) and in_array('seo_url', $attributes) and empty($this->seo_url)) {
         $this->seo_url = StringHelper::asUrl($this->title);
     }
     if (in_array('title', $attributes) and in_array('seo_title', $attributes) and empty($this->seo_title)) {
         $this->seo_title = $this->title;
     }
     if (in_array('description', $attributes) and in_array('seo_desc', $attributes) and empty($this->seo_desc)) {
         $this->seo_desc = $this->description;
     }
     // Upload image
     $image = \yii\web\UploadedFile::getInstance($this, 'image');
     if (!empty($image)) {
         $this->image = \yii\web\UploadedFile::getInstance($this, 'image');
         $ext = FileHelper::getExtention($this->image);
         if (!empty($ext)) {
             $fileDir = LetHelper::getAvatarDir($this->primaryKey) . '/';
             $fileName = $this->primaryKey . '.jpg';
             //$fileName = $this->primaryKey . '.' . $ext;
             $folder = Yii::$app->params['uploadPath'] . '/' . Yii::$app->params['uploadDir'] . '/' . $fileDir;
             FileHelper::createDirectory($folder);
             $this->image->saveAs($folder . $fileName);
             $this->image = $fileDir . $fileName;
         }
     } else {
         $this->image = $this->image_old;
     }
     // creator, editor and time
     $now = new \MongoDate();
     if (in_array('update_time', $attributes) and empty($this->update_time)) {
         $this->update_time = $now;
     }
     if (in_array('editor', $attributes) and !ClientHelper::isCommandLine()) {
         $this->editor = Yii::$app->user->id;
     }
     if ($this->isNewRecord) {
         if (in_array('creator', $attributes) and !ClientHelper::isCommandLine()) {
             $this->creator = Yii::$app->user->id;
         }
         if (in_array('create_time', $attributes) and $this->create_time == null) {
             $this->create_time = $now;
         }
     }
     if (!empty($this->password)) {
         $this->password_hash = Yii::$app->getSecurity()->generatePasswordHash($this->password);
     }
     if ($this->isNewRecord) {
         $this->auth_key = bin2hex(Yii::$app->getSecurity()->generateRandomKey());
         $this->auth_key = substr($this->auth_key, 0, 32);
     }
     return true;
 }
示例#4
0
 public function generateValidationHash($code)
 {
     $code_len = mb_strlen($code);
     for ($h = 0, $i = $code_len - 1; $i >= 0; --$i) {
         $char = mb_substr($code, $i, 1);
         $h += StringHelper::charCode($char);
     }
     return $h;
 }
示例#5
0
 /**
  * 修改密码
  * @return bool
  */
 public function changePassword()
 {
     $id = Yii::$app->user->identity->id;
     $user = User::findOne($id);
     if (is_null($user)) {
         return false;
     }
     $user->salt = Str::random(10);
     $user->password = $user->generatePassword($this->password);
     return $user->save(false);
 }
示例#6
0
 public function getAssetUrl($bundle, $asset)
 {
     $url = parent::getAssetUrl($bundle, $asset);
     $absPath = \Yii::getAlias('@webroot') . $url;
     if (is_file($absPath)) {
         $mtime = filemtime($absPath);
         $md = md5($mtime);
         $v = substr($md, 0, 8);
         $url .= StringHelper::contains($url, '?') ? '&' : '?';
         $url .= "v={$v}";
     }
     return $url;
 }
示例#7
0
 /**
  * 忘了密码
  */
 public function forgot()
 {
     if ($this->validate()) {
         $passwordReminder = new PasswordReminder();
         $passwordReminder->email = $this->email;
         $passwordReminder->token = Str::random(40);
         $passwordReminder->created_at = new Carbon();
         $passwordReminder->save(false);
         Yii::$app->mail->compose('forgotpassword', ['token' => $passwordReminder->token])->setTo($this->email)->setSubject(Yii::$app->id . ' 重置密码邮件')->send();
         return true;
     }
     return false;
 }
示例#8
0
文件: Upload.php 项目: semnt/tp01
 public static function uploadFile($file, &$result, $options = [])
 {
     $rootTmp = static::getTmpUploadsRoot();
     // FileHelper::dirTtlClear( $rootTmp, 3600, [ 'deep' => true ]);
     $rndKey = StringHelper::rndHex(8);
     $ex = strtolower($file->getExtension());
     $key = "{$rndKey}.{$ex}";
     $path = "{$rootTmp}/{$key}";
     $file->saveAs($path);
     $result[$key] = [];
     if (array_key_exists('cbSave', $options)) {
         $options['cbSave']($file, $key, $path, $result);
     }
 }
示例#9
0
 /**
  * @param array $attributes
  * @return void|static
  */
 public static function create(array $attributes = [])
 {
     // Add salt
     if (!array_key_exists('secret', $attributes) || $attributes['secret'] == '') {
         $secret = StringHelper::generateRandomString(20);
         $attributes['secret'] = $secret;
     }
     // Account status
     $attributes['account_status'] = self::ACCOUNT_ACTIVE;
     $model = parent::create($attributes);
     // Generate passkey
     UserPasskey::create(['user_id' => $model->id, 'passkey' => md5(StringHelper::generateRandomString() . time() . $model->secret)]);
     return $model;
 }
示例#10
0
 /**
  * Creates a new User model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new User();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->validate()) {
             $model->salt = Str::random(10);
             $model->password = $model->generatePassword($model->password);
             if ($model->save(false)) {
                 Yii::$app->session->setFlash('create_user', '用户添加成功:您可以继续添加新用户,或返回用户列表。');
                 return $this->redirect(['create']);
             }
         }
     }
     return $this->render('create', ['model' => $model]);
 }
示例#11
0
 public function resetPassword()
 {
     if ($this->validate()) {
         $user = User::findByEmail($this->email, true);
         if (is_null($user)) {
             $this->addError('email', '无效的邮箱');
             return false;
         }
         $user->salt = Str::random(10);
         $user->password = $user->generatePassword($this->password);
         return $user->save();
     }
     $this->addError('password', '重置密码失败');
     return false;
 }
示例#12
0
 public function getFamiliyaInicialy()
 {
     $result = '';
     if ($this->familiya) {
         $result = $this->familiya;
     }
     if ($this->imya) {
         if ($result) {
             $result .= StringHelper::nbsp();
         }
         $result .= mb_substr($this->imya, 0, 1) . '.';
     }
     if ($result && $this->otchestvo) {
         $result .= StringHelper::nbsp() . mb_substr($this->otchestvo, 0, 1) . '.';
     }
     return $result;
 }
示例#13
0
 public function actionIndex()
 {
     $list = ['0985812321', '0983252556', '0985788876', '0915644761', '0962174093', '0943390573', '0904015747', '01235830292', '0978436699', '0945496514', '0985928766', '0978331828', '0989198126', '0983303050', '0989568453', '0913290355', '0904830989', '0973629669', '01694633133', '0966688889', '0913037160', '0947255116', '0906561429', '0983091405', '09096123483', '0945664486', '09044203889', '01627273784', '0942891991', '0979866822', '0983994659', '0962785555', '0906904290', '0983573069', '0912796281', '0904316663', '0913000228', '0988584468', '0982992080', '0965281199', '0936468089', '0915170789', '0933452011', '0915645678', '0936169395', '0979859336', '0904881982', '0966265422', '0917805162', '0936272202', '0989900086', '0967141112', '0989342246', '0968026399', '0934319777', '0983088128', '0943666970', '0936668925', '01689991999', '0978585878', '0913079780', '0978551030', '0983763733', '0986949088', '0906098008', '01648297192', '0976851988', '01687986879', '0984684824', '0912152916', '0904963369', '0936083536', '0914899842', '0967055879', '01242308656', '0962949567', '0974977688', '0988825923', '0919674216', '09766661196', '0972822296', '01296336972', '0916243838', '0984408927', '0918395395', '0906515988', '0976750828', '0985451286', '0936368485', '0966243246', '0932251987', '0946416636', '01649557758', '0987170650', '0983811386', '0979581099', '0915195098', '0923228886', '0912991409', '0987418811', '0939701922', '0122406698', '0989012738', '0919020814', '0913924042', '0944774117', '0938060311', '090384144', '0903589401', '0913790918', '0917406050', '0904132737', '0946459699', '0903407696', '0903278121', '0989084707', '01686086222', '0988264966', '0932322433', '0906163263', '0989264968', '0983841986', '0902899907', '0975099593', '0904311415', '0986730686', '0909667620', '0936195991', '0904179944', '0904315171', '0913111968', '0989828625', '0939961888', '09344512233', '0983626243', '0986368858', '0966191468', '01278997238', '0936848680', '0944530515', '0985684585', '0987834236', '0963626976', '0904246696', '0934356356', '0904009282', '0943461088', '0914849286', '0982570009', '0916423623', '0904961961', '0946676132', '0967306777', '01696993073', '0936363680', '0948513786', '0913005097', '09122866686', '01292295989', '0983000037', '0914335245', '0162716128', '0988069561', '0904009113', '0966012096', '0963790469', '0973493593', '0979402312', '0988090069', '0904655768', '01688741438', '0978259738', '0904338669', '0978138568', '01252821980', '0975521645', '01657699918', '01628758954', '0945989988', '0972272383', '0915688833', '09122443502', '0904646655', '0946042555', '0943346678', '0912640905'];
     foreach ($list as $key => $phone) {
         echo $phone = StringHelper::asPhone($phone);
         echo ' - ';
         echo $code = substr($phone, -6);
         $message = 'Ma nhan The cao CT: CAO NGAY - TRUNG LON tai BiboMart cua a/c là: ' . $code . '. Vui long giu lai tin nhan de nhan The cao may man. L/H: 1900555580 (nhanh 2)';
         $sendSms = new \app\modules\sms\helpers\SmsBrandname();
         $sendSms->phoneNumber = $phone;
         $sendSms->message = $message;
         $sendSms->type = 'CSKH';
         $sendSms->campaign = 'Cào ngay - Trúng lớn';
         $sendSms->sent();
         echo "\n";
     }
 }
示例#14
0
 protected function validateValue($value)
 {
     $badStructure = 'Неправильная структура данных.';
     try {
         $decoded = Json::decode($value);
     } catch (InvalidParamException $e) {
         return [$badStructure];
     }
     if (!array_key_exists(0, $decoded) || !array_key_exists(1, $decoded)) {
         return [$badStructure];
     }
     $state = $decoded[0];
     $value = $decoded[1];
     if (!in_array($state, [ComboWidget::STATE_LIST, ComboWidget::STATE_TEXT])) {
         return [$badStructure];
     }
     if ($this->required === true) {
         $validator = new RequiredValidator();
         $error = null;
         if (!$validator->validate($value, $error)) {
             return [$error];
         }
     }
     if ($value === null || $value === '') {
         $this->_targetValue = null;
         return null;
     }
     if ($state === ComboWidget::STATE_LIST) {
         $this->_targetValue = ['id' => (int) $value];
         return null;
     }
     if ($state === ComboWidget::STATE_TEXT) {
         $value = StringHelper::squeezeLine($value);
         $validator = new NazvanieValidator();
         $error = null;
         if (!$validator->validate($value, $error)) {
             return [$error];
         }
         $this->_targetValue = ['nazvanie' => $value];
         return null;
     }
     return [$badStructure];
 }
示例#15
0
 public function actionRegisterExtra()
 {
     $model = new User(['scenario' => 'register']);
     $modelExtra = new UserExtra();
     $oauth = false;
     // Dung kiem tra xem co dang ky qua OAuth hay ko
     if (($oauthParam = Yii::$app->request->getQueryParam('oauth')) != null) {
         if (($oauthData = StringHelper::decrypt($oauthParam)) != null) {
             $oauth = true;
             if ($model->email === null) {
                 $model->email = $oauthData['email'];
             }
             if ($model->display_name === null) {
                 $model->display_name = $oauthData['name'];
             }
         }
     }
     if ($model->load(Yii::$app->request->post()) and $model->validate() and $modelAdditionBlocks = LetHelper::saveAdditionBlocks($model)) {
         // Default value
         $model->status = User::STATUS_ACTIVE;
         // Bỏ qua bước xác thực khi đăng ký qua OAuth
         if ($oauth === true && !empty($oauthData)) {
             $model->openids = [$oauthData['provider'] => $oauthData['uid']];
         }
         if ($model->save()) {
             if (is_array($modelAdditionBlocks)) {
                 foreach ($modelAdditionBlocks as $modelAdditionBlock) {
                     $modelAdditionBlock->_id = (string) $model->_id;
                     $modelAdditionBlock->save();
                 }
             }
             Yii::$app->user->login($model);
             return $this->goHome();
         }
     }
     return $this->render('registerExtra', ['model' => $model, 'modelExtra' => $modelExtra]);
 }
示例#16
0
文件: _tema.php 项目: tsyrya/mybriop
use app\entities\Tema;
use app\helpers\ArrayHelper;
use app\helpers\StringHelper;
use app\helpers\Val;
use yii\web\View;
/**
 * @var $prefixNo integer
 * @var $temaRecord Tema
 * @var $this View
 */
$prefixNo = $prefixNo . '.' . Val::of($temaRecord, 'nomer');
$chasy = Val::of($temaRecord, 'chasy');
$nedelya = Val::of($temaRecord, 'nedelya');
$time = '';
$nbsp = StringHelper::nbsp();
if ($chasy) {
    $time .= "{$chasy}{$nbsp}ч.";
}
if ($nedelya) {
    if ($time) {
        $time .= ",{$nbsp}";
    }
    $time .= "{$nedelya}{$nbsp}неделя";
}
$caption = $prefixNo . ' ' . Val::asText($temaRecord, 'nazvanie');
if ($time) {
    $caption .= " ({$time})";
}
?>
<h4><?php 
示例#17
0
">
                        <i class="glyphicon glyphicon-share" style="font-size:0.5em;margin-right:1em;"></i>
                    </a>
                </h2>
                <p>
<?php 
    $html = Markdown::process($article->content, 'gfm');
    echo Str::closeTags(Str::limit($html, 200));
    ?>
                </p>
                <p>
                    <i class="glyphicon glyphicon-calendar"></i><span><?php 
    echo $article->created_at;
    ?>
(<?php 
    echo Str::friendlyDate($article->created_at);
    ?>
)</span>
                    <a target="_blank" href="<?php 
    echo Url::to(['site/view', 'slug' => $article->slug]);
    ?>
#comments">
                        <i class="glyphicon glyphicon-share" style="font-size:0.5em;"></i>
                    </a>
                    <a href="<?php 
    echo Url::to(['site/view', 'slug' => $article->slug]);
    ?>
#comments"
                       class="btn btn-default btn-xs" style="margin-top:-2px;"
                       role="button">评论(<?php 
    echo $article->comments_count;
示例#18
0
                    <a class="pull-left" href="#">
                        <?php 
    $img = $comment->user ? $comment->user->portraitSmall : '';
    $email = $comment->user ? $comment->user->email : '';
    ?>
                        <img class="media-object img-thumbnail" width="64" height="64" src="<?php 
    echo $img;
    ?>
" alt="头像(小)">
                    </a>
                    <div class="media-body well well-sm">
                        <h5 class="media-heading"><?php 
    echo $email;
    ?>
                            <small class="pull-right">发表于:<?php 
    echo Str::friendlyDate($comment->created_at);
    ?>
</small>
                        </h5>
                        <?php 
    echo Html::encode($comment->content);
    ?>
                    </div>
                </li>
<?php 
}
?>
            </ul>
<?php 
if (Yii::$app->session->hasFlash('comment_message')) {
    ?>
示例#19
0
 /**
  * @param FizLico|array $value
  * @param int $format
  * @throws InvalidParamException
  * @return string
  */
 public function asFizLico($value, $format = null)
 {
     if ($value === null) {
         return $this->nullDisplay;
     }
     if ($format === null) {
         $format = $this->fizLicoFormat;
     }
     if (!in_array($format, [self::FIZ_LICO_FORMAT_SHORT, self::FIZ_LICO_FORMAT_FULL])) {
         throw new InvalidParamException('Unknow $format value');
     }
     $result = [];
     $familiya = ArrayHelper::getValue($value, 'familiya');
     if ($familiya !== null && $familiya !== '') {
         $result[] = trim($familiya);
     }
     $imya = ArrayHelper::getValue($value, 'imya');
     $otchestvo = ArrayHelper::getValue($value, 'otchestvo');
     foreach ([$imya, $otchestvo] as $item) {
         $item = trim($item);
         if (!$item) {
             break;
         }
         switch ($format) {
             case self::FIZ_LICO_FORMAT_SHORT:
                 $result[] = mb_substr($item, 0, 1) . '.';
                 break;
             case self::FIZ_LICO_FORMAT_FULL:
             default:
                 $result[] = $item;
         }
     }
     switch ($format) {
         case self::FIZ_LICO_FORMAT_SHORT:
             return implode(StringHelper::nbsp(), $result);
         case self::FIZ_LICO_FORMAT_FULL:
         default:
             return implode(' ', $result);
     }
 }
示例#20
0
 public function buildUrl($id = NULL, $title = NULL)
 {
     $attributes = array_keys($this->getAttributes());
     if (empty($id)) {
         $id = $this->primaryKey;
     }
     $routes = ['/category/frontend/default/list', 'id' => $id, 'module' => $this->module];
     $slug = '';
     if (!empty($title)) {
         $slug = $title;
     } elseif (in_array('seo_title', $attributes) and !empty($this->seo_title)) {
         $slug = $this->seo_title;
     } elseif (in_array('name', $attributes) and !empty($this->name)) {
         $slug = $this->name;
     }
     $routes['slug'] = StringHelper::asUrl($slug);
     return Url::to($routes);
 }
示例#21
0
 public function generationUrl($id = NULL, $title = NULL)
 {
     $attributes = array_keys($this->getAttributes());
     if (empty($id)) {
         $id = $this->primaryKey;
     }
     // Create alias
     if (!empty($title)) {
         $alias = $title;
     } elseif (in_array('seo_title', $attributes) and !empty($this->seo_title)) {
         $alias = $this->seo_title;
     } elseif (in_array('title', $attributes) and !empty($this->title)) {
         $alias = $this->title;
     } else {
         $alias = '';
     }
     $alias = StringHelper::asUrl($alias);
     if (empty($alias)) {
         $alias = '/' . $this->moduleName . '-' . $id;
     } else {
         $alias = '/' . $alias . '-' . $this->moduleName . '-' . $id;
     }
     return $this->url = Url::to([$alias]);
 }
示例#22
0
文件: Image.php 项目: semnt/tp01
 public static function getRndKey()
 {
     return StringHelper::rndHex(8);
 }
示例#23
0
$form = ActiveForm::begin(['enableClientValidation' => false]);
$categories = Category::getCategories();
$items = ArrayHelper::map($categories, 'id', 'name');
$tab1 = $form->field($model, 'category_id')->dropDownList($items);
$tab1 .= $form->field($model, 'title')->textInput();
$slug = Html::tag('span', rtrim(Yii::$app->request->getHostInfo(), '/') . '/', ['class' => 'input-group-addon']);
$slugTemplate = "{label}\n<div class=\"input-group\">{$slug}{input}</div>\n{hint}\n{error}";
$tab1 .= $form->field($model, 'slug', ['template' => $slugTemplate])->textInput();
$tab1 .= MarkdownEditor::widget(['model' => $model, 'attribute' => 'content']);
$tab2 = $form->field($model, 'meta_title')->textInput();
$tab2 .= $form->field($model, 'meta_description')->textInput();
$tab2 .= $form->field($model, 'meta_keywords')->textInput();
$tab3 = '<div class="form-group field-article-author">
<label for="article-author" class="control-label">作者</label>
<p class="form-control-static">' . Html::encode($model->user->email) . '</p></div>';
$tab3 .= '<div class="form-group field-article-created-at">
<label for="article-created-at" class="control-label">创建时间</label>
<p class="form-control-static">' . $model->created_at . ' (' . Str::friendlyDate($model->created_at) . ')</p></div>';
$tab3 .= '<div class="form-group field-article-updated-at">
<label for="article-updated-at" class="control-label">更新时间</label>
<p class="form-control-static">' . $model->created_at . ' (' . Str::friendlyDate($model->updated_at) . ')</p></div>';
echo Tabs::widget(['items' => [['label' => '主要内容', 'options' => ['style' => 'padding:1em;'], 'content' => $tab1, 'active' => true], ['label' => 'SEO', 'content' => $tab2, 'options' => ['style' => 'padding:1em;']], ['label' => '文章相关信息', 'content' => $tab3, 'options' => ['style' => 'padding:1em;']]]]);
echo Html::a('重 置', ['update', 'id' => $model->id], ['class' => 'btn btn-default']);
?>

<?php 
echo Html::submitButton('提 交', ['class' => 'btn btn-success']);
?>

<?php 
ActiveForm::end();
示例#24
0
文件: sent.php 项目: quynhvv/stepup
                    <div class="row">
                        <div class="col-xs-12 col-sm-9 col-sm-push-3 col-main section-gap">
                            <div class="tab-content">
                                <div role="tabpanel">
                                    <h3>Message list filtering by: <?php 
echo Yii::t('message', 'Sent');
?>
</h3>
                                    <div class="table-responsive">
                                        <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $modelSearch, 'layout' => "{items}\n{pager}", 'pjax' => true, 'hover' => true, 'responsive' => true, 'columns' => [['class' => 'kartik\\grid\\CheckboxColumn'], ['attribute' => 'subject', 'format' => 'raw', 'value' => function ($model) {
    $messageSubject = empty($model->message_id) ? Html::encode($model->subject) : '[RE] ' . $model->message->subject;
    $messageId = empty($model->message_id) ? $model->primaryKey : $model->message->primaryKey;
    return Html::a($messageSubject, ['view', 'id' => $messageId], ['data-pjax' => 0]);
}], ['attribute' => 'content', 'format' => 'raw', 'value' => function ($data) {
    return StringHelper::truncateWords($data->content, 20);
}], ['attribute' => 'created_at', 'format' => 'raw', 'filter' => false, 'headerOptions' => ['style' => 'width:180px'], 'value' => function ($data) {
    return Yii::$app->formatter->asDatetime($data->created_at->sec);
}]]]);
?>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12 col-sm-3 col-sm-pull-9 col-sidebar">
                            <?php 
echo $this->render('_sidebar');
?>
                        </div>
                    </div>
                </div>
示例#25
0
 /**
  * Handles model creation in DB
  *
  * @param array $attributes
  * @return static
  */
 public static function create(array $attributes = [])
 {
     // Add a random string as a key for extra security
     if (!array_key_exists('string_id', $attributes) || $attributes['string_id'] == '') {
         $attributes['string_id'] = StringHelper::generateRandomString(5);
     }
     return parent::create($attributes);
 }