rentalmanager/amenities

Rental Manager Amenities package which propels the basic system where you can manage properties for rent.

v2.0.1 2018-09-11 20:11 UTC

This package is auto-updated.

Last update: 2024-04-12 08:51:04 UTC


README

A package made for Rentbits for easier maintenance and modularity of managing rental listings. It includes all migrations, models and relations to run the rental system.

Installation, Configuration and Usage

Installation

Via Composer

composer require rentalmanager/amenities

Configuration

Once you install the package, it should be automatically discovered by the Laravel. To check this, in your terminal simply run the:

$ php artisan

There you should find the all rm:* commands.

First step after checking is to publish the vendors:

$ php artisan vendor:publish --tag="amenities"

After that it depends on you. If you are a hard learner, run through each commands manually, but then you can just simply run the

$ php artisan rm:setup-amenities

Thats it...

$ composer dump-autoload

You can add seeder class to your DB seeder like:

$this->call(RentalManagerAmenitiesSeeder::class);

Or by running the seeder directly by invoking:

$ php artisan db:seed --class=RentalManagerAmenitiesSeeder 

Usage

Below is the sample usages of this package:

To attach the single amenity to a unit or a property (the same applies)

$object->attachAmenity(1);

To attach multiple amenities

$object->attachAmenities([1,2,3]);

There is common sync methods as well

$object->syncAmenities([1,2,3]);

and without detaching

$object->syncAmenitiesWithoutDetaching([1,2,3]);

Scopes

This package provides a usable scope for amenitable objects

// get all objects where amenities are
$result = $object->whereAmenitiesAre([1,2,3]);

And few scopes for the amenity model itself

$amenities = Amenity::byGroup('notable');

$amenities = Amenity::byType('unit');

// disctinct by groups
$groups = Amenity::groups();

$types = Amenity::types();