本文整理汇总了PHP中app\Image::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::orderBy方法的具体用法?PHP Image::orderBy怎么用?PHP Image::orderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Image
的用法示例。
在下文中一共展示了Image::orderBy方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compose
public function compose(View $view)
{
$tags = Tag::orderBy('id', 'DESC')->get();
$categories = Category::orderBy('id', 'DESC')->simplepaginate(7);
$images = Image::orderBy('id', 'DESC')->paginate(4);
$view->with('tags', $tags)->with('categories', $categories)->with('images', $images);
}
示例2: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$articles = Article::OrderBy('id', 'DESC')->paginate(7);
$categories = Category::orderBy('name', 'ASC')->get();
$tags = Tag::orderBy('name', 'ASC')->get();
$images = Image::orderBy('article_id', 'DESC')->get();
return view('admin.index')->with('articles', $articles)->with('tags', $tags)->with('images', $images)->with('categories', $categories);
}
示例3: index
public function index()
{
$results = ['columns' => [['Id', 'id'], ['Create time', 'created_at'], ['Update time', 'updated_at'], ['Operation', 'buttons', function ($data) {
$buttons = [['Detail'], ['Delete']];
return $buttons;
}]]];
$paginate = Image::orderBy('id')->paginate();
$results['items'] = $paginate;
return $this->view('forone::' . $this->uri . '.index', compact('results'));
}
示例4: searchTag
public function searchTag($name)
{
$tag = Tag::SearchTag($name)->first();
$articles = $tag->articles()->paginate(14);
$images = Image::orderBy('id', 'ASC')->paginate(4);
$articles->each(function ($articles) {
$articles->category;
$articles->images;
});
return view('vistas.index')->with('articles', $articles)->with('images', $images);
}
示例5: upload
public function upload($id = null)
{
if (!empty($id)) {
$images = Image::where('id_product', '=', $id)->orderBy('id', 'DESC')->get();
$id_product = $id;
return view('image.upload', compact('images', 'id_product'));
} else {
$images = Image::orderBy('id', 'DESC')->get();
return view('image.upload', compact('images'));
}
}
示例6: feed
public function feed()
{
$tags = Tag::where('id', '>', 0)->get();
$phototags = PhotoTag::where('image_id', '>', 0)->get();
$images = Image::orderBy('updated_at', 'desc')->paginate(10);
if (Auth::check()) {
$votes = Auth::user()->votes()->get();
return view('feed')->with(['images' => $images, 'tags' => $tags, 'votes' => $votes, 'phototags' => $phototags]);
}
return view('feed')->with(['images' => $images, 'tags' => $tags, 'phototags' => $phototags]);
}
示例7: all
public function all()
{
return Image::orderBy('created_at', 'desc')->simplePaginate(24);
}
示例8: test
public function test()
{
$images = Image::orderBy('year', 'asc')->get();
return view('pages/test', compact('images'));
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
*
* @return Response
*/
public function store(Request $request)
{
try {
if (!$request->hasFile('photo')) {
return $this->respondWithError('No photo is selected');
}
$file = $request->file('photo');
// Create Eloquent object
$image = new Image();
$image->point_id = $request->id;
$image->filename = $this->generate_random_string();
$image->mime_type = $file->getClientMimeType();
$image->base_64 = $this->convert_to_base_64($file);
$image->created_by = Auth::user()->id;
$image->updated_by = Auth::user()->id;
if (!$image->save()) {
// If creation fails
// Return error response
return $this->respondInternalError();
}
// Select latest row from DB
$resp = $image->orderBy('id', 'DESC')->first();
// return with Fractal
return Fractal::item($resp, new \App\Transformers\ImageTransformer())->responseJson(200);
} catch (Exception $e) {
return $this->respondInternalError();
}
}
示例10: getImagesWithPaginate
public function getImagesWithPaginate(Request $request)
{
$perPage = $request->get('num');
if (!is_numeric($perPage) || $perPage < 1 || $perPage > 30) {
$perPage = 15;
}
$images = ImageModel::orderBy('id', 'desc')->paginate($perPage);
return $this->buildResponse(trans('api.image.paginate.success'), Tools::toArray($images));
}
示例11: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index($type)
{
$events = Event::where('status', '1')->where('type', $type)->orderBy('updated_at', 'desc')->get();
$images = Image::orderBy(\DB::raw('RAND()'))->take(4)->get();
return view($type . '.index', compact('events', 'images', 'now'));
}
示例12: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
*
* @return Response
*/
public function edit($id)
{
$configuracion = Configuracion::findOrFail($id);
$image = Image::orderBy('filename', 'asc')->lists('filename', 'filename');
return view('admin.configuracion.edit', compact('configuracion', 'image'));
}