本文整理汇总了PHP中Illuminate\Support\Facades\DB::collection方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::collection方法的具体用法?PHP DB::collection怎么用?PHP DB::collection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\DB
的用法示例。
在下文中一共展示了DB::collection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: keywords
public function keywords()
{
$limit = 25;
$projections = array('id', 'value');
$keywords = DB::collection('map_reduce_twitter_words')->orderBy('value', 'desc')->paginate($limit, $projections);
return view('keywords')->with(['keywords' => $keywords]);
}
示例2: getByValue
public function getByValue($field, $value)
{
// Returns the original Mongo Result
// ->where('store.name', 'like', '%' . $field . '%')
$result = DB::collection('food_cards_collection')->where($field, 'like', '%' . $value . '%')->get();
return response()->json($result);
}
示例3: getStore
public function getStore($search)
{
// May want to clean up search string first
$searchStr = $search;
// Returns the original Mongo Result
$result = DB::collection('food_cards_collection')->where('store.name', 'like', '%' . $searchStr . '%')->get();
return response()->json($result);
}
示例4: run
public function run()
{
DB::collection('users')->delete();
DB::collection('users')->insert(['name' => 'John Doe', 'seed' => true]);
}
示例5: keywords
public function keywords()
{
$keywords = DB::collection('map_reduce_twitter_words')->orderBy('value', 'desc')->paginate(25);
return $this->response->withPaginator($keywords, new KeywordsTransformer());
}
示例6: editDocument
/**
* @param string $collectionName
* @param string $documentId
* @param array $data - [key => val, ...]
* @return bool
*/
public function editDocument($collectionName, $documentId, $data)
{
$dbResponse = DB::collection($collectionName)->where($documentId)->update($data);
return $this->checkResult($dbResponse);
}