当前位置: 首页>>代码示例>>PHP>>正文


PHP Model::__construct方法代码示例

本文整理汇总了PHP中Illuminate\Database\Eloquent\Model::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::__construct方法的具体用法?PHP Model::__construct怎么用?PHP Model::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Database\Eloquent\Model的用法示例。


在下文中一共展示了Model::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct(array $attributes = [])
 {
     $place = last(explode('/', request()->server()['REQUEST_URI']));
     #request()->route('place');
     $this->hasAttachedFile('image_desktop', ['styles' => ['crop' => function ($file, $imagine) {
         $image = $imagine->open($file->getRealPath());
         if (request()->input('crop.image_desktop.w') >= 0 && request()->input('crop.image_desktop.y') >= 0) {
             $image->crop(new \Imagine\Image\Point(request()->input('crop.image_desktop.x'), request()->input('crop.image_desktop.y')), new \Imagine\Image\Box(request()->input('crop.image_desktop.w'), request()->input('crop.image_desktop.h')));
         }
         return $image;
     }], 'default_url' => 'http://placehold.it/' . config('mbanners.places.' . $place . '.desktop.width') . 'x' . config('mbanners.places.' . $place . '.desktop.height')]);
     if (config('mbanners.places.' . $place . '.tablet') !== false) {
         $this->hasAttachedFile('image_tablet', ['styles' => ['crop' => function ($file, $imagine) {
             $image = $imagine->open($file->getRealPath());
             if (request()->input('crop.image_tablet.w') >= 0 && request()->input('crop.image_tablet.y') >= 0) {
                 $image->crop(new \Imagine\Image\Point(request()->input('crop.image_tablet.x'), request()->input('crop.image_tablet.y')), new \Imagine\Image\Box(request()->input('crop.image_tablet.w'), request()->input('crop.image_tablet.h')));
             }
             return $image;
         }], 'default_url' => 'http://placehold.it/' . config('mbanners.places.' . $place . '.tablet.width') . 'x' . config('mbanners.places.' . $place . '.tablet.height')]);
     }
     if (config('mbanners.places.' . $place . '.mobile') !== false) {
         $this->hasAttachedFile('image_mobile', ['styles' => ['crop' => function ($file, $imagine) {
             $image = $imagine->open($file->getRealPath());
             if (request()->input('crop.image_mobile.w') >= 0 && request()->input('crop.image_mobile.y') >= 0) {
                 $image->crop(new \Imagine\Image\Point(request()->input('crop.image_mobile.x'), request()->input('crop.image_mobile.y')), new \Imagine\Image\Box(request()->input('crop.image_mobile.w'), request()->input('crop.image_mobile.h')));
             }
             return $image;
         }], 'default_url' => 'http://placehold.it/' . config('mbanners.places.' . $place . '.mobile.width') . 'x' . config('mbanners.places.' . $place . '.mobile.height')]);
     }
     parent::__construct($attributes);
 }
开发者ID:mixdinternet,项目名称:banners,代码行数:31,代码来源:Banner.php

示例2: __construct

 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     if ($connection = config('tagging.connection')) {
         $this->connection = $connection;
     }
 }
开发者ID:nilsenj,项目名称:itway,代码行数:7,代码来源:Tag.php

示例3: __construct

 /**
  * {@inheritDoc}
  */
 public function __construct(array $attributes = [])
 {
     $this->table = config('vi-kon.auth.table.user_permissions');
     $this->timestamps = false;
     $this->casts = [static::FIELD_TOKEN => 'string'];
     parent::__construct($attributes);
 }
开发者ID:vi-kon,项目名称:laravel-auth,代码行数:10,代码来源:Permission.php

示例4: __construct

 public function __construct($attributes = array())
 {
     //Eloquent model base construction
     parent::__construct($attributes);
     //App\Article
     //$this->user_id = 1; //TEMPORARY TEST
 }
开发者ID:sobrod,项目名称:Laravel-Sandbox-5,代码行数:7,代码来源:Article.php

示例5: __construct

 public function __construct($attributes = [])
 {
     parent::__construct($attributes);
     if ($this->useSti()) {
         $this->setAttribute($this->stiClassField, get_class($this));
     }
 }
开发者ID:vidmahovic,项目名称:ep-store,代码行数:7,代码来源:BaseModel.php

示例6: __construct

 public function __construct($tablename, $data)
 {
     parent::__construct($data);
     if ($tablename) {
         $this->setTable($tablename);
     }
 }
开发者ID:bartholf,项目名称:denise,代码行数:7,代码来源:ModelBase.php

示例7: __construct

 /**
  * constructor
  */
 public function __construct(array $attributes = array())
 {
     $this->timestamps = true;
     // call superclass constructor
     //
     Model::__construct($attributes);
 }
开发者ID:pombredanne,项目名称:open-swamp,代码行数:10,代码来源:TimeStamped.php

示例8: __construct

 /**
  * Create a new Eloquent model instance.
  *
  * @param  array  $attributes
  */
 public function __construct(array $attributes = [])
 {
     parent::__construct($attributes);
     if ($connection = config('database.default')) {
         $this->setConnection($connection);
     }
 }
开发者ID:awatbayazidi,项目名称:foundation,代码行数:12,代码来源:Model.php

示例9: __construct

 public function __construct($attributes = array())
 {
     parent::__construct($attributes);
     // initialize empty messages object
     $this->errors = new \Illuminate\Support\MessageBag();
     $this->modelName = get_class($this);
 }
开发者ID:iyoworks,项目名称:elegant,代码行数:7,代码来源:Model.php

示例10: __construct

 public function __construct(array $attributes = [])
 {
     parent::__construct($attributes);
     $this->errors = new MessageBag();
     $this->validator = \App::make('validator');
     $this->manejaConcurrencia = true;
 }
开发者ID:kentronvzla,项目名称:webkentron,代码行数:7,代码来源:BaseModel.php

示例11: __construct

 /**
  * __construct.
  *
  * @method __construct
  *
  * @param array $attributes
  */
 public function __construct(array $attributes = [])
 {
     if (empty($attributes['hash'])) {
         $attributes['hash'] = Random::generateToken();
     }
     parent::__construct($attributes);
 }
开发者ID:recca0120,项目名称:laravel-payum,代码行数:14,代码来源:Token.php

示例12: __construct

 /**
  * {@inheritDoc}
  */
 public function __construct(array $attributes = [])
 {
     $this->table = config('vi-kon.auth.table.user_roles');
     $this->timestamps = false;
     $this->casts = [static::FIELD_TOKEN => 'string', static::FIELD_STATIC => 'boolean', static::FIELD_HIDDEN => 'boolean'];
     parent::__construct($attributes);
 }
开发者ID:vi-kon,项目名称:laravel-auth,代码行数:10,代码来源:Role.php

示例13: __construct

 public function __construct(array $attributes = array())
 {
     $this->hasAttachedFile('krapin');
     $this->hasAttachedFile('titledeed');
     $this->hasAttachedFile('passportphoto');
     parent::__construct($attributes);
 }
开发者ID:kharhys,项目名称:revenue,代码行数:7,代码来源:Plot.php

示例14: __construct

 /**
  * constructor
  */
 public function __construct(array $attributes = array())
 {
     $this->timestamps = false;
     // call superclass constructor
     //
     parent::__construct($attributes);
 }
开发者ID:pombredanne,项目名称:open-swamp,代码行数:10,代码来源:BaseModel.php

示例15: __construct

 /**
  *
  * @param type $module
  * @param type $entity
  * @param array $attributes
  */
 public function __construct($module = null, $entity = null, array $attributes = [])
 {
     parent::__construct($attributes);
     if ($module && $entity) {
         $this->setScaffold($module, $entity);
     }
 }
开发者ID:wilcorrea,项目名称:awesovel,代码行数:13,代码来源:Model.php


注:本文中的Illuminate\Database\Eloquent\Model::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。