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); }
/** * 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); }
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')); }
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); }
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')); } }
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]); }
public function all() { return Image::orderBy('created_at', 'desc')->simplePaginate(24); }
public function test() { $images = Image::orderBy('year', 'asc')->get(); return view('pages/test', compact('images')); }
/** * 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(); } }
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)); }
/** * 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')); }
/** * 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')); }