本文整理汇总了PHP中Item::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::where方法的具体用法?PHP Item::where怎么用?PHP Item::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mostrarInfo
public function mostrarInfo($url)
{
//Me quedo con el item, buscando por url
$item = Item::where('url', $url)->first();
$this->array_view['item'] = $item;
return View::make($this->folder_name . '.' . $this->project_name . '-ver', $this->array_view);
}
示例2: categoryModify
public function categoryModify(Request $request, $id)
{
$cat_to_mod = Category::where('id', $id)->first();
$inputs = $request->except('_token', 'button');
if ($request->button == 'mod') {
$x = 0;
foreach ($inputs as $input) {
if (!empty($input)) {
$x = 1;
}
}
if ($x == 0) {
return redirect('admin');
}
if ($request->name) {
$cat_to_mod->name = $request->name;
}
$cat_to_mod->save();
}
if ($request->button == 'del') {
$item_count = Item::where('category_id', $id)->get()->count();
if ($item_count >= 1) {
return redirect('admin')->withErrors('Suppression impossible : des produits appartiennent a cette catgorie');
}
$cat_to_mod->delete();
return redirect('admin')->with('status', 'Catégorie supprimée');
}
return redirect('admin')->with('status', 'Modifications de la catégorie enregistrées');
}
示例3: showIndex
public function showIndex()
{
if (!Auth::check()) {
return View::make('login', array('title' => 'edison'));
}
$category_names = array('ent' => 'エンターテイメント', 'music' => '音楽', 'sing' => '歌ってみた', 'play' => '演奏してみた', 'dance' => '踊ってみた', 'vocaloid' => 'VOCALOID', 'nicoindies' => 'ニコニコインディーズ', 'animal' => '動物', 'cooking' => '料理', 'nature' => '自然', 'travel' => '旅行', 'sport' => 'スポーツ', 'lecture' => 'ニコニコ動画講座', 'drive' => '車載動画', 'history' => '歴史', 'politics' => '政治', 'science' => '科学', 'tech' => 'ニコニコ技術部', 'handcraft' => 'ニコニコ手芸部', 'make' => '作ってみた', 'anime' => 'アニメ', 'game' => 'ゲーム', 'toho' => '東方', 'imas' => 'アイドルマスター', 'radio' => 'ラジオ', 'draw' => '描いてみた', 'are' => '例のアレ', 'diary' => '日記', 'other' => 'その他', 'r18' => 'R-18', 'original' => 'オリジナル', 'portrait' => '似顔絵', 'character' => 'キャラクター');
$all_items = Item::orderBy('created_at', 'desc')->take(10)->get();
foreach ($all_items as &$item) {
$item['user'] = User::where('id', '=', $item->user_id)->get()[0];
$item['star_count'] = Starmap::where('item_id', '=', $item->id)->count();
$item['comment_count'] = Comment::where('item_id', '=', $item->id)->count();
if ($item->category_id != 0) {
$item['category'] = Category::where('id', '=', $item->category_id)->get()[0]->content;
}
}
$recent_works = Work::orderBy('created_at', 'desc')->take(10)->get();
foreach ($recent_works as &$work) {
$item = Item::where('id', '=', $work->item_id)->get()[0];
$work['item'] = $item;
$work['user'] = User::where('id', '=', $work->user_id)->get()[0];
$work['item_poster_screen_name'] = User::where('id', '=', $item->user_id)->get()[0]->screen_name;
if ($item->category_id != 0) {
$work['item_category'] = Category::where('id', '=', $item->category_id)->get()[0]->content;
}
}
$user = User::where('screen_name', '=', Auth::user()->screen_name)->get()[0];
$data = array('title' => 'edison', 'user' => $user, 'all_items' => $all_items, 'recent_works' => $recent_works, 'categories' => $category_names, 'star_count' => Starmap::where('user_id', '=', $user->id)->count(), 'work_count' => Work::where('user_id', '=', Auth::user()->id)->count());
return View::make('index', $data);
}
示例4: run
public function run()
{
$participants = DB::table('event_participant')->get();
foreach ($participants as $participant) {
$player = Player::find($participant->player_id);
$user = User::find($participant->user_id);
$event = Evento::find($participant->event_id);
$payment = Payment::find($participant->payment_id);
$uuid = Uuid::generate();
$new = new Participant();
$new->id = $uuid;
$new->firstname = $player->firstname;
$new->lastname = $player->lastname;
$new->due = $event->getOriginal('fee');
$new->early_due = $event->getOriginal('early_fee');
$new->early_due_deadline = $event->early_deadline;
$new->method = 'full';
$new->plan_id = Null;
$new->player_id = $player->id;
$new->event_id = $participant->event_id;
$new->accepted_on = $participant->created_at;
$new->accepted_by = $user->profile->firstname . " " . $user->profile->lastname;
$new->accepted_user = $participant->user_id;
$new->status = 1;
$new->created_at = $participant->created_at;
$new->updated_at = $participant->updated_at;
$new->save();
$update = Item::where('payment_id', '=', $payment->id)->firstOrFail();
$update->participant_id = $uuid;
$update->save();
}
}
示例5: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
if ($this->user->inGroup(Sentry::findGroupByName('supporter')) || $this->user->inGroup(Sentry::findGroupByName('administer'))) {
$items = Item::orderBy('id', 'desc')->paginate(10);
} else {
$items = Item::where('user_id', '=', $this->user->id)->orderBy('id', 'desc')->paginate(10);
}
return View::make('items.index', compact('items'));
}
示例6: update
/**
* Update the specified resource in storage.
* PUT /items/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
$item = Item::where('id', $id)->update(Input::all());
if ($item) {
return ['status' => true, 'item' => $item];
} else {
return ['status' => false];
}
}
示例7: Item
function item_delete()
{
$item = new Item();
$item->where('id', $this->post('id'));
$item->get();
$item->delete();
$message = array('id' => $this->post('id'), 'message' => 'DELETED!');
$this->response($message, 200);
// 200 being the HTTP response code
}
示例8: index
public function index()
{
try {
$items = Item::where('active', '=', '1')->orderBy('vendor_id')->orderBy('name')->get();
foreach ($items as $item) {
$item->vendor_name = Vendor::where('id', '=', $item->vendor_id)->pluck('name');
}
return $items->toJSON();
} catch (Exception $e) {
return json_encode('{"error":{"text":' . $e->getMessage() . '}}');
}
}
示例9: isRoom
public function isRoom($item)
{
// player location
$currentRoom = Auth::user();
$currentRoom = $currentRoom->player_location_id;
$itemRoom = Item::where("name", $item)->firstOrFail();
$itemRoom = $itemRoom->map_id;
if ($currentRoom == $itemRoom) {
return true;
} else {
return false;
}
}
示例10: getStars
public function getStars($screen_name)
{
$user = User::where('screen_name', '=', $screen_name)->first();
$star_lists = Starmap::where('user_id', '=', $user->id)->orderby('created_at', 'desc')->take(10)->get();
$star_items = array();
foreach ($star_lists as &$star_list) {
$star_list['item'] = Item::where('id', '=', $star_list->item_id)->get()[0];
$star_list['item']['user'] = User::where('id', '=', $star_list->item->user_id)->get()[0];
$star_list['item']['star_count'] = Starmap::where('id', '=', $star_list->item_id)->count();
$star_list['item']['comment_count'] = Comment::where('id', '=', $star_list->item_id)->count();
$star_list['category_name'] = Category::where('id', '=', $star_list->item->category_id)->first()->content;
}
return $star_lists;
}
示例11: index
/**
* Display a listing of the resource.
* GET /oss
*
* @return Response
*/
public function index()
{
$documents = Auth::user()->documents;
$i = 0;
$num = $documents->count();
if ($num == 0) {
$ids = 0;
} else {
foreach ($documents as $document) {
$ids[$i] = $document->id;
}
}
$items = Item::where('document_id', $ids)->get();
return View::make('items.oss')->with('items', $items);
}
示例12: vistaListado
public function vistaListado()
{
$items_borrados = Item::where('estado', 'B')->lists('id');
if (count($items_borrados) > 0) {
$portfolios = Portfolio::whereNotIn('item_id', $items_borrados)->get();
} else {
$portfolios = Portfolio::all();
}
$categorias = Categoria::where('estado', 'A')->get();
$secciones = Seccion::where('estado', 'A')->get();
$this->array_view['portfolios'] = $portfolios;
$this->array_view['categorias'] = $categorias;
$this->array_view['secciones'] = $secciones;
//Hace que se muestre el html lista.blade.php de la carpeta item
//con los parametros pasados por el array
return View::make($this->folder_name . '.lista', $this->array_view);
}
示例13: index
public function index()
{
$documents = Auth::user()->documents;
$i = 0;
$num = $documents->count();
if ($num == 0) {
$ids = 0;
} else {
foreach ($documents as $document) {
$ids[$i] = $document->id;
}
}
$organization = Auth::user()->organization;
$items = Item::where('document_id', $ids)->get();
return View::make('home', array('documents' => $documents, 'items' => $items, 'organization' => $organization));
//return View::make('timeout');
}
示例14: getNoticeContents
public function getNoticeContents()
{
$login_user_id = Auth::user()->id;
$notice = Starmap::where('user_id', '=', $login_user_id)->where('watched_flag', '=', 0)->where('notice_flag', '=', 1)->get();
$notice_item_ids = array();
foreach ($notice as $n) {
$notice_item_ids[] = $n["item_id"];
}
$notice_items_uesr = array();
$notice_item_titles = array();
$notice_work_ids = array();
foreach ($notice_item_ids as $notice_item_id) {
$notice_items_uesr_ids[] = Item::where('id', '=', $notice_item_id)->get()[0]['user_id'];
$notice_item_titles[] = Item::where('id', '=', $notice_item_id)->get()[0]['title'];
$notice_work_ids[] = Work::where('item_id', '=', $notice_item_id)->orderBy('created_at', 'desc')->get()[0]['item_id'];
}
//$this->debug($notice_work_ids);
$notice_work_user_ids = array();
$notice_work_title = array();
foreach ($notice_work_ids as $notice_work_id) {
var_dump($notice_work_id);
$notice_work_user_ids[] = Work::where('id', '=', $notice_work_id)->orderBy('updated_at', 'asc')->get()[0]['user_id'];
$notice_work_title[] = Work::where('id', '=', $notice_work_id)->orderBy('id', 'asc')->get()[0]['title'];
}
$this->debug($notice_work_user_ids);
//$this->debug($notice_work_title);
// ---------
$notice_work_user_screen_name = array();
foreach ($notice_work_user_ids as $notice_work_user_id) {
$notice_work_user_screen_name = User::where('id', '=', $notice_work_user_id)->get()[0]['screen_name'];
}
//$this->debug($notice_work_user_screen_name);
$notice_item_screen_name = array();
foreach ($notice_items_uesr_ids as $user_id) {
$notice_item_screen_name[] = User::where('id', '=', $user_id)->get()[0]['screen_name'];
}
$json_val = array("notice_title" => $notice_item_titles, "notice_item_id" => $notice_item_ids, "notice_item_user" => $notice_item_screen_name, "notice_work_title" => $notice_work_title, "notice_work_user" => $notice_work_user_screen_name);
header('Content-type: application/json');
echo json_encode($json_val);
}
示例15: create
public function create($item_id)
{
$data = Input::all();
$item = Item::where('id', '=', $item_id)->get()[0];
$screen_name = User::where('id', '=', $item->user_id)->first()['attributes']['screen_name'];
$now = date("Y-m-d H:i:s");
if ($item['type'] == 'video') {
$reg = '/^http:\\/\\/www\\.nicovideo\\.jp\\/watch\\/(sm[0-9]+)/';
} else {
$reg = '/^http:\\/\\/seiga\\.nicovideo\\.jp\\/seiga\\/im([0-9]+)/';
}
preg_match($reg, $data['url'], $match);
$nico_content = $match ? $match[1] : 0;
if ($item['type'] == 'video') {
$Niconico = new Niconico();
$ret = $Niconico->getThumbInfo($nico_content);
$title = $ret->title;
$thumbnail_url = $ret->thumbnail_url;
} else {
$title = '';
$thumbnail_url = "http://lohas.nicoseiga.jp/thumb/{$nico_content}q";
}
if ($nico_content) {
$work = new Work();
$work->item_id = $item_id;
$work->user_id = Auth::user()->id;
$work->url = $data['url'];
$work->title = $title;
$work->thumbnail_url = $thumbnail_url;
$work->comment = nl2br(htmlspecialchars($data['comment']));
$work->created_at = date("Y-m-d H:i:s");
$work->updated_at = date("Y-m-d H:i:s");
$work->save();
Starmap::where('item_id', '=', $item_id)->update(array('notice_flag' => 1));
return Redirect::to("/{$screen_name}/items/{$item_id}");
} else {
echo "その作品はあかん";
}
}