本文整理汇总了PHP中Picture::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Picture::where方法的具体用法?PHP Picture::where怎么用?PHP Picture::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Picture
的用法示例。
在下文中一共展示了Picture::where方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gallary
public function gallary()
{
$album_id = Input::get("album_id");
$user_id = Input::get("user_id");
$photos = Picture::where("album_id", "=", $album_id)->get();
return View::make('userCenter.gallary')->with(array("photos" => $photos, "user_id" => $user_id, "album_id" => $album_id));
}
示例2: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
// $user = User::findOrFail($id);
$ued = Sentry::getUser()->id;
$user = $this->user->find($id);
//$products = DB::table('products')->where('user_id',$ued)->get();
$products = Product::where('user_id', $ued)->paginate(10);
//$picture = DB::table('pictures')->where('user_id',$ued)->find(1);
$image = Picture::where('user_id', $ued)->orderBy('id', 'desc')->get()->take(1);
// $images = $user->pictures->find(1);
return View::make('protected.standardUser.edit')->withUser($user)->with('products', $products)->with('image', $image);
}
示例3: getView
public function getView($id)
{
$album = Album::where('id', '=', $id)->first();
$pictures = Picture::where('album_id', '=', $id)->orderBy('votes', 'desc')->paginate(12);
// layouts variables
$this->layout->title = $album->name . ' | Нещо Шантаво';
$this->layout->canonical = 'https://neshto.shantavo.com/album/' . $id;
$this->layout->robots = 'index,follow,noodp,noydir';
$this->layout->description = 'Това е албум';
$this->layout->keywords = 'начало, нещо шантаво, team navy pier';
// nesting the view into the layout
$this->layout->nest('content', 'album.view', array('album' => $album, 'pictures' => $pictures));
}
示例4: postVote
public function postVote()
{
$isVoted = false;
$picture = Picture::where('id', '=', Input::get('id'))->first();
if (Auth::check()) {
foreach ($picture->voted as $vote) {
if ($vote->user->id == Auth::user()->id) {
$isVoted = true;
}
}
if (!$isVoted) {
Picture::where('id', '=', Input::get('id'))->increment('votes', 1);
Vote::insert(array('picture_id' => $picture->id, 'user_id' => Auth::user()->id));
$picture = Picture::where('id', '=', Input::get('id'))->first();
return intval($picture->votes);
}
}
return false;
}
示例5: getByRefId
public static function getByRefId($refId, $type)
{
$images = Picture::where('ref_id', $refId)->where('image_type', $type)->get();
return $images;
}
示例6: deleteUpload
/**
* Action: Delete resource images
* @param int $id post ID
* @return response
*/
public function deleteUpload($id)
{
// Allow only pictures of the current article being deleted
$filename = Picture::where('id', $id)->where('user_id', Auth::user()->id)->first();
$oldImage = $filename->filename;
if (is_null($filename)) {
return Redirect::back()->with('error', '没有找到对应的图片');
} elseif ($filename->delete()) {
// Delete images
File::delete(public_path('uploads/articles/' . $oldImage));
return Redirect::back()->with('success', '图片删除成功。');
} else {
return Redirect::back()->with('warning', '图片删除失败。');
}
}