/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $layout = Layout::find($id); $layout->delete(); return \Redirect::route('layout.index'); }
/** * Attach Elements to layout. * * @param \Element ID */ public function attachMessage($elementId, $messageId) { //TODO Error handeling if message is already added $element = Element::find($elementId); $element->messages()->attach($messageId); $data['element'] = Layout::find($elementId); $data['linkedMessages'] = ElementsController::getMessages($elementId); $data['unlinkedMessages'] = ElementsController::getUnlinkedMessages($elementId); //TODO redirect to correct url return redirect()->back(); //return \View::make('Elements.show')->with($data); }