Download the PHP package onramplab/laravel-custom-fields without Composer

On this page you can find all versions of the php package onramplab/laravel-custom-fields. 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-custom-fields

laravel-custom-fields

CircleCI Total Downloads

The purpose of this package is to enable custom field support for any Laravel models.

Custom fields can be utilized to extend a model and offer a more flexible approach for incorporating additional fields, without requiring the addition of new attributes to the database model.

Requirements

Features

Installation

Install the package via composer

Publish migration files and run command to build tables needed in the package

Run the migration to create the necessary tables in the database

Usage

Defining Custom Fields

Custom field attributes

Here's an example of the Lead model and Account model code snippets along with their usage:

  1. To define custom fields for lead model, we need to use the Customizable trait in the Lead model class.

  2. Since the context for those fields is provided by an associated Account model, we need to use Contextable trait in the Account model class and overwrite the getContext method of the Customizabletrait. By overriding the getContext() method in the Lead model, we specify that the context for the Lead model is the associated Account model. This ensures that the custom fields defined for the Lead model are associated with the respective Account.

After setting up the above configurations, you can proceed with the following steps:

  1. Define custom fields using the CustomField model.
  2. Create leads as you normally would, but include additional custom fields under the custom key, as defined in the previous step.

  3. If the custom field value passes validation, it will be stored in the CustomFieldValue table.
  4. Retrieve custom field values just like any other attribute of the Lead model but with the prefix custom. For example, you can access a custom field value using $lead->custom_zip.

By following these steps, you can seamlessly work with custom fields for the Lead model and access their values as if they were regular attributes.

Running Tests:

composer test

Contributing

  1. Fork it.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Make your changes.
  4. Run the tests, adding new ones for your own code if necessary (phpunit).
  5. Commit your changes (git commit -am 'Added some feature').
  6. Push to the branch (git push origin my-new-feature).
  7. Create new pull request.

Also please refer to CONTRIBUTION.md.

License

Please refer to LICENSE.


All versions of laravel-custom-fields with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
doctrine/dbal Version ^3.6
illuminate/support Version ^8.0|^9.0|^10.0
tightenco/parental Version ^1.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 onramplab/laravel-custom-fields contains the following files

Loading the files please wait ....