本文整理匯總了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);
}