Laravel.io
module.factory('Resource', ['$resource', function($resource) {
    return function(url, params, methods) {
		/**
		 * The resource method helps setup a resource endpoint using AngularJS' $resource service.
		 *
		 * @returns $resource
		 */
		this.resource = function() {
			var defaults = {
				update: {method: 'put', isArray: false},
				create: {method: 'post'}
			};

			methods = _.extend(defaults, methods);

			var resource = $resource(url, params, methods);

			resource.prototype.$save = function(data, callback) {
				if (!this.id) {
					this.$create(data, callback);
				}
				else {
					this.$update(data, callback);
				}
			};

			resource.lower = function() {
				return this.name.toLowerCase();
			};

			resource.lowerPlural = function() {
				return this.lower().pluralize();
			};

			return resource;
		};

		/**
		 * Specifies the name (in lower case) of the resource.
		 *
		 * @type {null}
		 */
		this.name = null;
	};
}]);

Please note that all pasted data is publicly available.