本文整理汇总了PHP中Review::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Review::where方法的具体用法?PHP Review::where怎么用?PHP Review::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Review
的用法示例。
在下文中一共展示了Review::where方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display all comments by productId.
*
* @return Response
*/
public function index($productId)
{
$product = Product::where('id', $productId)->first();
$reviews = Review::where('productId', $productId)->get();
$product["reviews"] = $reviews;
return $product;
}
示例2: getIndex
public function getIndex()
{
// 酒のレビューを取得。現在はサンプルのレビューを使用。
$reviews = Review::where('item_id', 41)->take(4)->get();
$last_result = array();
/*-----------------------------------------
* 形態素解析, 係受け構文解析
*---------------------------------------*/
foreach ($reviews as $review) {
$params = array('type' => 'chunk', 'text' => $review->content);
$yahoo_result = YahooApi::fetch($params);
if ($yahoo_result === false) {
continue;
}
$last_result = Chunk::getChunks($yahoo_result, $review->content, $review, $last_result, $review->is_bought);
}
/*-----------------------------------------
* 類義語検索
*---------------------------------------*/
foreach ($last_result as $key => $value) {
$s = explode(',', $value['info']);
// 名詞が形容詞にかかっている場合
if (preg_match('/.*?(名詞)/u', $s[2]) && preg_match('/.*?(形容|動詞)/u', $s[6])) {
$adje = explode('-', $s[6]);
// 品詞
$pos = explode('-', $s[5]);
// 単語
$_adje = explode('-', $s[2]);
// 品詞
$_pos = explode('-', $s[1]);
// 単語
// for ($i = 0; $i < count($_adje); $i++) {
// $syno = null;
// if (preg_match('/.*?(名詞)/u', $_adje[$i]) && count($_adje) > 1) {
// if ($_adje[0] == '名詞' && $_adje[1] == '助動詞') {
// $syno = Thesaurus::checkThesaurus($_pos[$i]);
// $_ll_result = array();
// if ($syno) {
// $_ll_result['text'] = $syno['text'];
// $_ll_result['rayer'] = $syno['rayer'];
// $_ll_result['info'] = $value['info'];
// $ll_result[trim($syno['text'])][] = $_ll_result;
// }
// }
// }
// }
for ($i = 0; $i < count($adje); $i++) {
$syno = null;
if (preg_match('/^(形容|動詞)/u', $adje[$i], $match)) {
// 形容詞が含まれていれば
if ($match[0] == '形容') {
$syno = Thesaurus::checkThesaurus($pos[$i]);
if ($syno && $syno->text == '無い') {
for ($j = 0; $j < count($_adje); $j++) {
if ($_adje[$j] == '名詞') {
$syno = Thesaurus::checkThesaurus($_pos[$i]);
}
}
}
} else {
if ($match[0] == '動詞') {
$_syno = Thesaurus::checkThesaurus($pos[$i]);
if ($_syno && isset($pos[1])) {
if (in_array($pos[0] . $pos[1], explode(',', $_syno->synonym))) {
$syno = $_syno;
}
}
}
}
if (!isset($syno)) {
break;
}
$_ll_result = array();
// もし同じような形容詞があれば1つにまとめていく
if ($syno) {
$_ll_result['text'] = $syno['text'];
$_ll_result['rayer'] = $syno['rayer'];
$_ll_result['info'] = $value['info'];
$ll_result[trim($syno['text'])][] = $_ll_result;
}
}
}
} else {
if (preg_match('/.*?(副詞)/u', $s[2]) && preg_match('/.*?(名詞)/u', $s[6])) {
$adje = explode('-', $s[6]);
// 品詞
$pos = explode('-', $s[5]);
// 単語
$_adje = explode('-', $s[2]);
// 品詞
$_pos = explode('-', $s[1]);
// 単語
for ($i = 0; $i < count($adje); $i++) {
$syno = null;
if (preg_match('/.*?(名詞)/u', $adje[$i])) {
$syno = Thesaurus::checkThesaurus($pos[$i]);
$_ll_result = array();
if ($syno) {
$_ll_result['text'] = $syno['text'];
$_ll_result['rayer'] = $syno['rayer'];
//.........这里部分代码省略.........
示例3: delete
public function delete($user_id = NULL)
{
$user = $this->prepare_user($user_id);
if ($this->ion_auth->is_admin($user_id)) {
$url = 'manage_admins';
} elseif ($this->ion_auth->is_manager($user_id)) {
$url = 'manage_accounts';
} else {
$url = 'admin_users';
}
if ($this->ion_auth->is_collaborator($user_id)) {
$this->c_user->delete($user);
}
$user_deleted = $this->ion_auth->delete_user($user->id);
if (!$user_deleted) {
$this->addFlash(lang('delete_error', [$this->ion_auth->errors()]));
redirect('admin/admin_users');
}
$sender = $this->get('core.mail.sender');
$sender->sendUserDeleteMail(array('user' => $user));
$access_token = new Access_token();
$access_token->where('user_id', $user->id)->get()->delete_all();
$directory_user = new Directory_User();
$directory_user->where('user_id', $user->id)->get()->delete_all();
$facebook_fanpage = new Facebook_Fanpage();
$facebook_fanpage->where('user_id', $user->id)->get()->delete_all();
$keyword = new Keyword();
$keyword->where('user_id', $user->id)->get();
foreach ($keyword as $k) {
$keyword_rank = new Keyword_rank();
$keyword_rank->where('keyword_id', $k->id)->get()->delete_all();
}
$keyword->delete_all();
$media = new Media();
$media->where('user_id', $user->id)->get()->delete_all();
$post = new Post();
$post->where('user_id', $user->id)->get();
foreach ($post as $p) {
$post_social = new Post_social();
$post_social->where('post_id', $p->id)->get()->delete_all();
}
$post->delete_all();
$review = new Review();
$review->where('user_id', $user->id)->get()->delete_all();
$reviews_notification = new Reviews_notification();
$reviews_notification->where('user_id', $user->id)->get()->delete_all();
$rss_feeds_users = new Rss_feeds_users();
$rss_feeds_users->where('user_id', $user->id)->get()->delete_all();
$social_post = new Social_post();
$social_post->where('user_id', $user->id)->get()->delete_all();
$social_value = new Social_value();
$social_value->where('user_id', $user->id)->get()->delete_all();
$user_additional = new User_additional();
$user_additional->where('user_id', $user->id)->get()->delete_all();
$user_feed = new User_feed();
$user_feed->where('user_id', $user->id)->get()->delete_all();
$user_timezone = new User_timezone();
$user_timezone->where('user_id', $user->id)->get()->delete_all();
$this->addFlash(lang('delete_success'), 'success');
redirect('admin/' . $url);
}
示例4: make
public function make()
{
$params = Input::all();
$id = $params['item-id'];
// 決定表作成時はmax_execution_timeの制限を外す
set_time_limit(3000);
// TODO: ファイル作成する部分。ファイル以外で実現したい
//$file_name = 'drh.dat';
$file_name = $id . '.dat';
$fp = fopen('assets/dat/' . $file_name, 'w');
// 酒のレビューを取得。現在はサンプルのレビューを使用。
$reviews = Review::where('item_id', $id)->get();
$last_result = array();
/*-----------------------------------------
* 形態素解析, 係受け構文解析
*---------------------------------------*/
foreach ($reviews as $review) {
$params = array('type' => 'chunk', 'text' => $review->content);
$yahoo_result = YahooApi::fetch($params);
if ($yahoo_result === false) {
continue;
}
$last_result = Chunk::getChunks($yahoo_result, $review->content, $review, $last_result, $review->is_bought);
}
/*-----------------------------------------
* 類義語検索
*---------------------------------------*/
foreach ($last_result as $key => $value) {
$s = explode(',', $value['info']);
// 名詞が形容詞にかかっている場合
if (preg_match('/.*?(名詞)/u', $s[2]) && preg_match('/.*?(形容|動詞)/u', $s[6])) {
$adje = explode('-', $s[6]);
// 品詞
$pos = explode('-', $s[5]);
// 単語
$_adje = explode('-', $s[2]);
// 品詞
$_pos = explode('-', $s[1]);
// 単語
for ($i = 0; $i < count($_adje); $i++) {
$syno = null;
if (preg_match('/.*?(名詞)/u', $_adje[$i]) && count($_adje) > 1) {
if ($_adje[0] == '名詞' && $_adje[1] == '助動詞') {
$syno = Thesaurus::checkThesaurus($_pos[$i]);
}
$_ll_result = array();
if ($syno) {
$_ll_result['text'] = $syno['text'];
$_ll_result['rayer'] = $syno['rayer'];
$_ll_result['info'] = $value['info'];
$ll_result[trim($syno['text'])][] = $_ll_result;
}
}
}
for ($i = 0; $i < count($adje); $i++) {
$syno = null;
if (preg_match('/^(形容|動詞)/u', $adje[$i], $match)) {
// 形容詞が含まれていれば
if ($match[0] == '形容') {
$syno = Thesaurus::checkThesaurus($pos[$i]);
if ($syno && $syno->text == '無い') {
for ($j = 0; $j < count($_adje); $j++) {
if ($_adje[$j] == '名詞') {
$syno = Thesaurus::checkThesaurus($_pos[$i]);
}
}
}
} else {
if ($match[0] == '動詞') {
$_syno = Thesaurus::checkThesaurus($pos[$i]);
if ($_syno && isset($pos[1])) {
if (in_array($pos[0] . $pos[1], explode(',', $_syno->synonym))) {
$syno = $_syno;
}
}
}
}
if (!isset($syno)) {
break;
}
$_ll_result = array();
// もし同じような形容詞があれば1つにまとめていく
if ($syno) {
$_ll_result['text'] = $syno['text'];
$_ll_result['rayer'] = $syno['rayer'];
$_ll_result['info'] = $value['info'];
$ll_result[trim($syno['text'])][] = $_ll_result;
}
}
}
// for ($i = 0; $i < count($adje); $i++) {
// if (preg_match('/.*?(形容)/u', $adje[$i], $match)) { // 形容詞が含まれていれば
// $syno = Thesaurus::checkThesaurus($pos[$i]);
// $_ll_result = array();
// // もし同じような形容詞があれば1つにまとめていく
// if ($syno) {
// $_ll_result['text'] = $syno['text'];
// $_ll_result['rayer'] = $syno['rayer'];
// $_ll_result['info'] = $value['info'];
// $ll_result[trim($syno['text'])][] = $_ll_result;
//.........这里部分代码省略.........
示例5: ReviewCount
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function ReviewCount($id)
{
return Review::where('fr_fl_id', $id)->count();
}
示例6: getAllRecords
public static function getAllRecords()
{
$sources = array(Contractor::where('status', '!=', 'deleted')->get(), Review::where('status', '!=', 'deleted')->get(), Service_request::all(), Lead::where('status', '!=', 'deleted')->get(), User::where('status', '!=', 'deleted')->get());
$sources_array = array();
$names_arr = array();
foreach ($sources as $source) {
$source->last()->latest = 'Latest ' . get_class($source->last());
foreach ($source as $record) {
All::formatRecord($record);
}
// $source->first()->classname = get_class($source->first());
array_push($sources_array, json_decode($source, TRUE));
array_push($names_arr, get_class($source->first()));
}
$big_arr = array_merge($sources_array[0], $sources_array[1], $sources_array[2], $sources_array[3], $sources_array[4]);
// return $names_arr;
return $big_arr;
}
示例7: getReviews
/**
* Get reviews for rendering reviews.
*
* @return array
*/
public function getReviews($itemId, $reviewItemId, $customerId = NULL)
{
global $data;
global $settings;
$reviewItems = Review::where('review_item_id', '=', $reviewItemId);
if ($itemId == NULL) {
$reviewItems->whereNull('item_id');
} else {
$reviewItems->where('item_id', '=', $itemId);
}
if ($customerId != NULL) {
$reviewItems->where('customer_id', '=', $customerId);
}
$reviews = $reviewItems->whereNull('deleted_at')->get()->toArray();
return $reviews;
}
示例8: getShow
public function getShow($id)
{
$user = $this->user->findOrFail($id);
// $userid = Sentry::getUser()->id;
// var_dump($userid); die();
$userid = User::findOrFail($id)->id;
$useremail = User::findOrFail($id)->email;
// var_dump($userid); die();
$galleries = Gallery::where('user_id', '=', $userid)->get();
$credentials = Credential::where('user_id', '=', $userid)->get();
$reviews = Review::where('to', '=', $useremail)->get();
// $services =
// $user = sentry::getUser();
// var_dump($user); die('here');
// $user = Sentry::findUserById($id);
// if(All::checkViewRight($user)):
// return All::checkViewRight($user);
// endif;
// return $galleries; die();
// return $reviews; die('jere');
return View::make('users.show', compact('user', 'galleries', 'reviews'));
// return View::make('users.show', compact('user'));
}
示例9: fetchReviews
/**
* Fetches user reviews from database.
*
* @param string $name
* @return Paginator
*/
public function fetchReviews($id)
{
return \Review::where('user_id', $id)->paginate(10);
}
示例10: postUpdate
public function postUpdate()
{
$item_id = Input::get('item_id');
// TODO: とりあえずすべてのレビューを消去してすべて更新する方法採用。後々訂正
// 更新するアイテムの取得
$item = Item::find($item_id);
$item_code = $item->item_code;
// 一旦関係のあるレビュー全削除
Review::where('item_id', '=', $item_id)->delete();
// 再度取得
Review::getReviews($item_code, $item_id);
}
示例11: getViewCount
public function getViewCount($id)
{
return Review::where('fr_usr_id', $id)->sum('fr_views');
}