Skip to content

Instantly share code, notes, and snippets.

@dura0ok
Created March 20, 2019 09:59
Show Gist options
  • Select an option

  • Save dura0ok/3fa0459ce8a35a57b4f98a9e5d914e8c to your computer and use it in GitHub Desktop.

Select an option

Save dura0ok/3fa0459ce8a35a57b4f98a9e5d914e8c to your computer and use it in GitHub Desktop.
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:27XnZEk081qxHdkf+DEEfDlVU9rYCuXkskCOQ8hgLas=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=core_production
DB_USERNAME=root
DB_PASSWORD=admin
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mail.ru
MAIL_PORT=465
MAIL_USERNAME=noreply@pochet-zhitel.ru
MAIL_PASSWORD=X]Q4oE6aeolK
MAIL_ENCRYPTION=ssl
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
version: "3"
services:
app:
container_name: "discounts-app"
build:
context: ./
volumes:
- ./:/var/www
- ./000-default.conf:/etc/apache2/sites-available/000-default.conf
- ./logs:/var/log/apache2
ports:
- 8080:80
working_dir: /var/www
depends_on:
- mysql
mysql:
container_name: "discounts-db"
image: mysql:5.7
volumes:
- dbdata
environment:
MYSQL_ROOT_PASSWORD: admin
MYSQL_DATABASE: core_production
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
ports:
- 33306:3306
volumes:
dbdata:
@extends('v2.layout.index')
@section('title', 'Почетный житель.РФ')
@section('head')
<script src="https://api-maps.yandex.ru/2.1/?apikey=a26b77ce-25b7-4d0c-aa26-161e16fa6b94&lang=ru_RU"
type="text/javascript" defer>
</script>
@endsection
@section('content')
@include ('v2.index.parts.promo')
@include ('v2.index.parts.deals')
@include ('v2.index.parts.profits')
@include ('v2.index.parts.searchorcreate')
@include ('v2.index.parts.companies')
@include ('v2.index.parts.map')
@include ('v2.index.parts.faq')
@endsection
@section('scripts')
<script>
var coords = [
@foreach($mapPoints as $point)
{
coords: [{{ $point->lat }}, {{ $point->long }}],
hint: "{{ $point->shop->name }}",
contentHeader: "{{ $point->shop->name }}",
type: "islands#blackStretchyIcon"
},
@endforeach
];
</script>
<script defer src="{{ asset('js/yamaps.js') }}"></script>
@endsection
<?php
namespace App\Http\Controllers\v2;
use App\Banner;
use App\Category;
use App\Faq;
use App\Shop;
use App\Shoplocation;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
class IndexController extends Controller
{
public function index(Request $request)
{
$companies = Shop::byCity($request)
->visible()
->orderBy('rating', 'desc')
->orderBy('id', 'desc')
->limit(8)
->get();
$categories = Category::with('shops', 'shoplocations')->get();
$faqs = Faq::isVisible()->get();
$banners = Banner::byCity()->byVisibleBanners()->get();
$mapPoints = Shoplocation::byCity($request)->orderBy('id', 'DESC')
->with(['shop:id,name,category_id', 'shop.category'])
->limit(50)->get();
dd($mapPoints);
return view('v2.index.index')
->with('companies', $companies)
->with('categories', $categories)
->with('faqs', $faqs)
->with('banners', $banners)
->with('mapPoints', $mapPoints);
}
}
document.addEventListener('DOMContentLoaded', function () {
if (coords.length > 0) {
ymaps.ready(function () {
var myMap = new ymaps.Map("map", {
center: [64.542984, 40.537155],
zoom: 12
});
var myGeoObjects = [];
for (var i = 0; i<coords.length; i++) {
myGeoObjects[i] = new ymaps.GeoObject({
geometry: {
type: "Point",
coordinates: coords[i].coords
},
properties: {
hintContent: coords[i].hint,
balloonContentHeader: coords[i].contentHeader,
}
}, {
// Опции.
// Иконка метки будет растягиваться под размер ее содержимого.
preset: coords[i].type,
// Метку можно перемещать.
draggable: true
});
}
var myClusterer = new ymaps.Clusterer();
myClusterer.add(myGeoObjects);
myMap.geoObjects.add(myClusterer);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment