Download the PHP package testinstance/laravel-model-profiles without Composer

On this page you can find all versions of the php package testinstance/laravel-model-profiles. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-model-profiles

Total Downloads Latest Version License

Laravel Model Profiles

Laravel Model Profiles allows the extension of conventional normalization forms where scaling is seen to be completed via rows representing value with data types and relational keys rather than additional tables and key based relations. Note - ONLY COMPATIBLE WITH LARAVEL FRAMEWORK

Why?

Profile tables allow the expansion or reduction of data points against a model without the need to add new columns to the original model table. For example, a 400 column table of data could be compressed down to a 1 column (primaryKey id) table.


Setup


Usage

Installation

composer require testinstance/laravel-model-profiles


We will use 'User.php' model as an example for this usage guide.

Make Model Profile

In order to use Laravel Model Profiles you must use the 'use HasProfile' trait on your selected model class. 'use TestInstance\LaravelModelProfiles\Traits\HasProfile;'.

Run php artisan make:profile ModelScope\ModelClassName

You will see that two new models and a migration file are created:

Run php artisan migrate

You will see that the user_profiles table is created with:

You will see that the user_profile_keys table is created with:

Interactions

Retrieve by profile value

`

$users will be a collection of users which have the profile value of blue for the profile_key name of color

whereProfile & whereProfileIn are a direct pass-through to the native Laravel where & whereIn so can be used as such. (Including searching for multiple parameters as an array: whereProfile(['color' => 'blue', 'anotherProfileKey' => 'anotherProfileValue'])).

The profileKey type will dictate which data type it relates to and will be casted as such. The available types are listed in the Laravel documentation here. Model casting in profile is an extension and will be documented after its full release.

Save profile value

To save a profile value you can simple use the following format: ``

Eagerloading

Every model with a profile will eagerload its profile. Profile attributes can be accessed the same way model attributes are.

Notes


Dependencies


Security

Please notify us of any security issues or concerns via [email protected]


License

Laravel Model Profiles is open-sourced software licensed under the MIT license.

Authors

Ballard-dev KieranFYI


All versions of laravel-model-profiles with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package testinstance/laravel-model-profiles contains the following files

Loading the files please wait ....