當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。