rentalmanager/utilities

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

v1.1.1 2018-08-07 12:01 UTC

This package is auto-updated.

Last update: 2024-04-12 08:17:38 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/utilities

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="utilities"

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-utilities

We assume you have already installed the Base package, so then just add traits automagically

$ php artisan rm:add-utilable-trait

Thats it...

Seed

This package provides some of the default data. You must seed them to your database.

You can publish seeder with the following command (it's actually separate function from the setup):

$ php artisan rm:seeder-utilities

The above command will create the propeller seeder class.

After you publish the seeder make sure you dump autoload of the composer cache, how your newly seeder class will be discovered.

$ composer dump-autoload

You can add seeder class to your DB seeder like:

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

Or by running the seeder directly by invoking:

$ php artisan db:seed --class=RentalManagerUtilitiesSeeder 

Usage

Below is the sample usages of this package:

To attach the single utility to a unit

$object->attachUtility(1);

To attach multiple utilities

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

There is common sync methods as well

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

and without detaching

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

Scopes

This package provides a usable scope for Utilable objects

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