public function data() { $collectionsBuilder = $this->repo->search('', false); return Datatables::of($collectionsBuilder)->addColumn('actions', function ($model) { return '<a class="btn default btn-xs purple" href="/collections/' . $model->id . '/edit' . '"><i class="fa fa-edit"></i> Editar </a> <a href="/collections/' . $model->id . '/delete' . '" class="btn btn-xs red"><i class="glyphicon glyphicon-trash"></i> </a>'; })->make(true); }
public function collection($collectionSlug, CollectionRepository $collectionRepo) { $products = $this->repository->collection($collectionSlug)->all(); $collection = $collectionRepo->firstOrFail($collectionSlug); $title = $collection->title; $lead = $collection->lead; $metaDescription = $collection->metaDescription; if ($products->isEmpty()) { abort(404); } return view('products.index', compact('products', 'title', 'lead', 'metaDescription')); }
/** * Remove the specified Collection from storage. * DELETE /collections/{id} * * @param int $id * * @return Response */ public function destroy($id) { $this->collectionRepository->apiDeleteOrFail($id); return $this->sendResponse($id, "Collection deleted successfully"); }