Illuminate\Database\Eloquent\Model::__construct PHP Метод

__construct() публичный Метод

Create a new Eloquent model instance.
public __construct ( array $attributes = [] ) : void
$attributes array
Результат void
    public function __construct(array $attributes = [])
    {
        $this->bootIfNotBooted();
        $this->syncOriginal();
        $this->fill($attributes);
    }

Usage Example

Пример #1
1
 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);
 }
All Usage Examples Of Illuminate\Database\Eloquent\Model::__construct
Model