本文整理汇总了PHP中type::with方法的典型用法代码示例。如果您正苦于以下问题:PHP type::with方法的具体用法?PHP type::with怎么用?PHP type::with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类type
的用法示例。
在下文中一共展示了type::with方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scopeCategorized
/**
* By Category
* @param type $query
* @param \Claremontdesign\Ecommerce\Model\Category $category
* @return type
*/
public function scopeCategorized($query, Category $category = null)
{
if (is_null($category)) {
return $query->with(cd_config('database.e.productCategory.table.name'));
}
$categoryIds = $category->getDescendantsAndSelf()->lists(cd_config('database.e.productCategory.table.primary'));
return $query->with('categories')->join(cd_config('database.e.productCategoryPivot.table.name'), cd_config('database.e.productCategoryPivot.table.name') . '.' . cd_config('database.e.product.table.primary'), '=', cd_config('database.e.product.table.name') . '.' . cd_config('database.e.product.table.primary'))->whereIn(cd_config('database.e.productCategoryPivot.table.name') . '.' . cd_config('database.e.productCategory.table.primary'), $categoryIds);
}
示例2: update
/**
*
* @param array $data
* @param type $id
* @return type
*/
public function update(array $data, $id)
{
try {
$this->validator->with($data)->passesOrFail();
return $this->repository->update($data, $id);
} catch (ValidatorException $e) {
return ['error' => 'true', 'messege' => $e->getMessageBag()];
} catch (\Exception $e) {
return ['error' => 'true', 'messege' => "Usuário não encontrado!"];
}
}
示例3: index
/**
*
* @return type
*/
public function index()
{
//$vendas = $this->vendas->join('clientes', 'vendas.cliente_id', '=', 'clientes.id')->select('clientes.nome')->get();
$vendas = $this->repository->with(['cliente', 'produto'])->all();
return view('painel::paginas.vendas', compact('vendas'));
}
示例4: compose
/**
* News and Version shared view variables
* @param type $view
*/
public function compose($view)
{
$view->with('senApiVersion', (new \Sentora\Providers\SentoraPublicApi())->latestStableVersion());
$view->with('senApiNews', (new \Sentora\Providers\SentoraPublicApi())->lastestNews());
}