Illuminate\Database\Eloquent\Builder::with PHP Method

with() public method

Set the relationships that should be eager loaded.
public with ( mixed $relations )
$relations mixed
    public function with($relations)
    {
        if (is_string($relations)) {
            $relations = func_get_args();
        }
        $eagers = $this->parseWithRelations($relations);
        $this->eagerLoad = array_merge($this->eagerLoad, $eagers);
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param int $publicId
  *
  * @return Order
  */
 public function byPublicId(int $publicId) : Order
 {
     /** @var Order $order */
     $order = $this->orderResource->with(self::DEFAULT_RELATIONS)->where('id', '=', Order::privateId($publicId))->first();
     if ($order instanceof Order) {
         return $order;
     }
     return new Order();
 }
All Usage Examples Of Illuminate\Database\Eloquent\Builder::with