/**
  * Remove the portfolio.
  *
  * @param Request $request
  * @param Model   $portfolio
  *
  * @return json
  */
 public function destroy(PortfolioAdminApiRequest $request, Portfolio $portfolio)
 {
     try {
         $t = $portfolio->delete();
         return response()->json(['message' => trans('messages.success.delete', ['Module' => trans('portfolio::portfolio.name')]), 'code' => 2006])->setStatusCode(202, 'DESTROY_SUCCESS');
     } catch (Exception $e) {
         return response()->json(['message' => $e->getMessage(), 'code' => 4006])->setStatusCode(400, 'DESTROY_ERROR');
     }
 }
 public function transform(\Litecms\Portfolio\Models\Portfolio $portfolio)
 {
     return ['id' => $portfolio->getRouteKey(), 'title' => ucfirst($portfolio->title), 'published' => $portfolio->published, 'details' => ucfirst($portfolio->details), 'category_id' => ucfirst($portfolio->category['name']), 'image' => $portfolio->image, 'images' => $portfolio->images, 'status' => ucfirst($portfolio->status), 'published' => $portfolio->published == 'Yes' ? 'Published' : '-'];
 }
Exemplo n.º 3
0
 /**
  * Remove the specified resource.
  *
  * @param int $id
  *
  * @return Response
  */
 public function destroy(PortfolioUserRequest $request, Portfolio $portfolio)
 {
     try {
         $this->repository->delete($portfolio->getRouteKey());
         return response()->json(['message' => trans('messages.success.deleted', ['Module' => trans('portfolio::portfolio.name')]), 'code' => 202, 'redirect' => trans_url('/user/portfolio/portfolio')], 202);
     } catch (Exception $e) {
         redirect()->back()->withInput()->with('message', $e->getMessage())->with('code', 400);
     }
 }
 /**
  * Remove the portfolio.
  *
  * @param Model   $portfolio
  *
  * @return Response
  */
 public function destroy(PortfolioAdminRequest $request, Portfolio $portfolio)
 {
     try {
         $t = $portfolio->delete();
         return response()->json(['message' => trans('messages.success.deleted', ['Module' => trans('portfolio::portfolio.name')]), 'code' => 202, 'redirect' => trans_url('/admin/portfolio/portfolio/0')], 202);
     } catch (Exception $e) {
         return response()->json(['message' => $e->getMessage(), 'code' => 400, 'redirect' => trans_url('/admin/portfolio/portfolio/' . $portfolio->getRouteKey())], 400);
     }
 }