本文整理汇总了PHP中Photo::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Photo::all方法的具体用法?PHP Photo::all怎么用?PHP Photo::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Photo
的用法示例。
在下文中一共展示了Photo::all方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show(Photo $photo)
{
// $photo = Photo::findOrFail(Input::get('id'));
$photos = Photo::all();
$related = array();
foreach ($photos as $dbphoto) {
if ($dbphoto->category == $photo['category']) {
array_push($related, $dbphoto);
}
}
return View::make('show', compact('photo'))->with('related', $related);
}
示例2: all
public function all()
{
return Photo::all();
}
示例3: home
public function home()
{
$photos = Photo::all();
return View::make('vtadmin', compact('photos'));
}
示例4: showPhotosIndex
public function showPhotosIndex()
{
if (Auth::check()) {
$userId = Auth::user()->id;
$photos = Photo::all();
$firstPhotos = array();
$users = array();
foreach ($photos as $photo) {
if (!in_array($photo->user_id, $users) && $userId != $photo->user_id) {
array_push($firstPhotos, $photo);
array_push($users, $photo->user_id);
}
}
return Response::json(array('error' => false, 'photos' => $firstPhotos), 200);
} else {
return Response::json(array('error' => true, 'reason' => 'not logged in'), 200);
}
}
示例5: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$this->_data['photos'] = Photo::all();
return View::make('photo.index', $this->_data);
}