properties()->translatedIn(app()->getLocale())->with('place')->get()) ->addColumn('options', function ($model) use ($category) { return View::make('partials.options-property', compact('model', 'category'))->render(); }) ->editColumn('type', function ($model) { return trans('attributes.'.$model->type); }) ->editColumn('price', function ($model) { return number_format($model->price) . ' €'; }) ->editColumn('surface', function ($model) { return $model->surface . ' m2'; }) ->editColumn('status', function ($model) { return $model->status ? trans('attributes.'.$model->status) : ''; }) ->make(true); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Category $category) { return view('property.index', compact('category')); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create(Category $category) { $property = new Property; return view('property.create', compact('category', 'property')); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(PropertyRequest $request, Category $category) { $property = $category->properties()->save(new Property($request->all())); return redirect()->route('admin.category.property.edit', [$category, $property]); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show(Category $category, Property $property) { return view('public.property', compact('category', 'property')); } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Category $category, Property $property) { return view('property.edit', compact('category', 'property')); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(PropertyRequest $request, Category $category, Property $property) { $property->update($request->all()); return redirect()->route('admin.category.property.index', $category); } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy(Category $category, Property $property) { $property->delete(); } }