Download the PHP package miladshm/controller-helpers without Composer

On this page you can find all versions of the php package miladshm/controller-helpers. 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 controller-helpers

Controller CRUD Helpers

Overview

This package is a set of helper traits for Laravel controllers. It provides a convenient and reusable way to handle common tasks such as API datatable, data storage, and data update and other crud operations in Laravel applications.

Tests Workflow

Install

Configuration

Usage

API Datatable

``

Set filters

``

Set default order

``

Set default page length

``

Set table columns to be in response

``

Set columns and first-hand relations to searching within

``

Set pagination type

You can choose index pagination type between default, simple and cursor paginator.

``

Store method with HasStore trait

The HasStore trait is part of the miladshm/controller-helpers package and is designed to handle the creation of new model instances in Laravel controllers. It provides a convenient and reusable way to perform common tasks related to storing data in your application.

Usage

To use the HasStore trait in your Laravel controller, follow these steps:

  1. Include the trait in your controller class:

``

  1. Implement the necessary methods and properties:

Define the model class used by the trait:

``

Override the storeCallback method if you need to perform additional actions after a new model instance is created:

``

Override the prepareForStore method if you need to perform any necessary preparations before a new model instance is created:

``

  1. Implement the validation logic:

Implement the requestClass method to define the form request class for the incoming request data:

``

  1. Customizing the response data:

If you want to customize the response when the new model instance is created, you can implement the getJsonResourceClass method and return your desired Api Resource Class:

``

That's it! You now have a working implementation of the HasStore trait in your Laravel controller. You can customize the trait further to fit your specific needs.

Update data with HasUpdate trait

The HasUpdate trait is part of the miladshm/controller-helpers package and is designed to handle the updating of specific items in your Laravel application. It provides a convenient and reusable way to perform common tasks related to updating data in your controllers.

Usage

To use the HasUpdate trait in your Laravel controller, follow these steps:

  1. Include the trait in your controller class:

``

  1. Implement the necessary methods and properties:

Define the model class used by the trait:

``

Override the prepareForUpdate method if you need to perform any necessary preparations before updating a model instance:

``

Override the updateCallback method if you need to perform additional actions after a model instance is updated:

``

Validation logic can be implemented by overriding the updateRequestClass method (Optional): if this method not implemented trait will use the class that provided by requestClass

``

That's it! You now have a working implementation of the HasUpdate trait in your Laravel controller. You can customize the trait further to fit your specific needs.

Change Position

Introduction:

The HasChangePosition trait is designed to provide a method for changing the position of an item in a sorted list. It uses the provided ChangePositionRequest to determine the direction of movement. This document will guide you through the usage of this trait in your Laravel application.

Usage:

  1. Include the trait in your controller class:

``

  1. Define the model used in the trait:

``

  1. Implement the filters method (optional): If you need to apply any filters to the query when retrieving the adjacent item, you can override the filters method. This method should accept a query builder instance and return the modified query builder.

``

  1. Define the getPositionColumn method (optional): If the name of the column used for sorting is different from the default (order_column), you can override the getPositionColumn method to return the correct column name.

``

Remember to handle any exceptions that may be thrown by the changePosition method, such as ValidationException if the item cannot be moved in the specified direction.

That's it! You now have a working implementation of the HasChangePosition trait in your Laravel application.


All versions of controller-helpers with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
illuminate/support Version >=9.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 miladshm/controller-helpers contains the following files

Loading the files please wait ....