public function storeLayer($request) { $layer = new Layer(); $values = $request->except('_token', '_method', 'map_id', 'source_id'); $layer->fill($values); $map = Map::findOrFail($request->map_id); $layer->map()->associate($map); $source = Source::findOrFail($request->source_id); $layer->source()->associate($source); $layer->save(); return $layer; }
public function destroyMap($id) { $map = Map::findOrFail($id); $result = Map::destroy($id); return $result; }