share('locales', config('translatable.locales')); view()->composer(['page._form'], function ($view) { $view->with('categories', [ '' => '', ]); }); view()->composer(['include.header', 'include.footer'], function ($view) { $view->with('categories', \App\Category::all()); }); view()->composer(['include.filter'], function ($view) { if(Request::input('place')) { $view->with('areas', \App\Place::find(Request::input('place'))->areas()->orderBy('name')->lists('name', 'id')); } else { $view->with('areas', []); } }); view()->composer('property._form', function ($view) { $view->with('places', ['' => ''] + \App\Place::orderBy('name')->lists('name', 'id')->toArray()); $data = $view->getData(); $property = $data['property']; if($property->place) { $view->with('areas', ['' => ''] + \App\Area::where('place_id', $property->place->id)->orderBy('name')->lists('name', 'id')->toArray()); } else { $view->with('areas', []); } $years = [''=>''] + array_combine($r=range(date("Y"),1900),$r); $numbers = [''=>''] + array_combine($r=range(1,30),$r); $boolean = [''=>'', '1' => 'Ne', '2' => 'Da']; $types = [''=>'', 'sale' => 'Prodaja', 'rent' => 'Najam']; $status = [''=>'', 'new' => 'Novo', 'discount' => 'Sniženo', 'sold' => 'Prodano']; $floors = [ '' => '', '-2' => 'Suteren', '-1' => 'Prizemlje', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', ]; $view->with('years', $years); $view->with('numbers', $numbers); $view->with('boolean', $boolean); $view->with('types', $types); $view->with('status', $status); $view->with('floors', $floors); }); view()->composer(['include.footer', 'public.property'], function ($view) { $view->with('latest', \App\Property::translatedIn(app()->getLocale())->latest()->paginate(3)); }); view()->composer(['include.filter', 'public.list-property'], function ($view) { $numbers = array_combine($r=range(1,10),$r); $prices = [ '0 and 50000' => 'do 50.000€', '50000 and 100000' => 'od 50.000€ - 100.000€', '100000 and 150000' => 'od 100.000€ - 150.000€', '150000 and 1000000' => '150.000€ -' ]; $order = [ 'id desc' => trans('global.latest'), 'id asc' => trans('global.oldest'), 'price asc' => trans('global.cheap'), 'price desc' => trans('global.expensive'), 'surface asc' => trans('global.min'), 'surface desc' => trans('global.max'), ]; $floors = [ '' => '', '-2' => 'Suteren', '-1' => 'Prizemlje', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', ]; $view->with('categories', \App\Category::all()->lists('name', 'id')->toArray()); $view->with('places', \App\Place::orderBy('name')->lists('name', 'id')->toArray()); $view->with('numbers', $numbers); $view->with('prices', $prices); $view->with('order', $order); $view->with('floors', $floors); }); } /** * Register any application services. * * @return void */ public function register() { // } }