本文整理匯總了PHP中app\Category::query方法的典型用法代碼示例。如果您正苦於以下問題:PHP Category::query方法的具體用法?PHP Category::query怎麽用?PHP Category::query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Category
的用法示例。
在下文中一共展示了Category::query方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: register
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->app->singleton('App\\Contracts\\Storages\\CategoryStorageContract', function () {
return new CategoryStorage(Category::query());
});
$this->app->singleton('App\\Contracts\\Storages\\ItemStorageContract', function () {
return new ItemStorage(Item::query());
});
$this->app->singleton('App\\Contracts\\Storages\\UserStorageContract', function () {
return new UserStorageProxy(new UserStorage(User::query()));
});
}
示例2: search
public function search($input)
{
$query = Category::query();
$columns = Schema::getColumnListing('$TABLE_NAME$');
$attributes = array();
foreach ($columns as $attribute) {
if (isset($input[$attribute])) {
$query->where($attribute, $input[$attribute]);
}
}
return $query->get();
}
示例3: search
public function search($input)
{
$query = Category::query();
$columns = Schema::getColumnListing('categories');
$attributes = array();
foreach ($columns as $attribute) {
if (isset($input[$attribute])) {
$query->where($attribute, $input[$attribute]);
$attributes[$attribute] = $input[$attribute];
} else {
$attributes[$attribute] = null;
}
}
return [$query->get(), $attributes];
}
示例4: destroy
/**
* Removes the category.
* @param $id
*
* @return \Illuminate\Http\RedirectResponse
* @throws \Exception
*/
public function destroy($id)
{
$this->category->query()->findOrFail($id)->delete();
return redirect()->route('category.index');
}