本文整理汇总了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);
}
示例2: __construct
public function __construct(array $attributes = array())
{
parent::__construct($attributes);
if ($connection = config('tagging.connection')) {
$this->connection = $connection;
}
}
示例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);
}
示例4: __construct
public function __construct($attributes = array())
{
//Eloquent model base construction
parent::__construct($attributes);
//App\Article
//$this->user_id = 1; //TEMPORARY TEST
}
示例5: __construct
public function __construct($attributes = [])
{
parent::__construct($attributes);
if ($this->useSti()) {
$this->setAttribute($this->stiClassField, get_class($this));
}
}
示例6: __construct
public function __construct($tablename, $data)
{
parent::__construct($data);
if ($tablename) {
$this->setTable($tablename);
}
}
示例7: __construct
/**
* constructor
*/
public function __construct(array $attributes = array())
{
$this->timestamps = true;
// call superclass constructor
//
Model::__construct($attributes);
}
示例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);
}
}
示例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);
}
示例10: __construct
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->errors = new MessageBag();
$this->validator = \App::make('validator');
$this->manejaConcurrencia = true;
}
示例11: __construct
/**
* __construct.
*
* @method __construct
*
* @param array $attributes
*/
public function __construct(array $attributes = [])
{
if (empty($attributes['hash'])) {
$attributes['hash'] = Random::generateToken();
}
parent::__construct($attributes);
}
示例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);
}
示例13: __construct
public function __construct(array $attributes = array())
{
$this->hasAttachedFile('krapin');
$this->hasAttachedFile('titledeed');
$this->hasAttachedFile('passportphoto');
parent::__construct($attributes);
}
示例14: __construct
/**
* constructor
*/
public function __construct(array $attributes = array())
{
$this->timestamps = false;
// call superclass constructor
//
parent::__construct($attributes);
}
示例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);
}
}