public function editProductCategory($id) { try { $category = ProductCategory::with('images')->findorFail($id); } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) { return App::abort(404); } $category = $category->toArray(); $category['images'] = reset($category['images']); $this->layout->title = 'Edit Product Category'; $this->layout->content = View::make('admin.product-categories-one')->with(['category' => $category, 'parent' => ProductCategory::getSource(false, $id)]); }