Download the PHP package tehekone/laravel-resources without Composer

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

Laravel Resource

Latest Stable Version License Total Downloads

Table of Contents

Click to expand

- [Introduction](#introduction) - [Installation](#installation) - [Usage](#usage) - [Defining Resource](#defining-resource) - [Defining Filters](#defining-filters) - [Cheat sheet](#cheat-sheet)

Introduction

Installation

You can install this package via composer using:

Alternatively, add these two lines to your composer require section:

Usage

...

Defining Resource

...

Defining Filters

Select Filters

Each select filter contains two methods: apply and options. The apply method is responsible for modifying the query to achieve the desired filter state, while the options method defines the "values" the filter may have. Let's take a look at an example UserType filter:

The options method should return an array of keys and values. The array's values will be passed into the apply method as the $value argument. This filter defines two possible values: admin and editor.

As you can see in the example above, you may leverage the incoming $value to modify your query. The apply method should return the modified query instance.

Boolean Filters

You may generate a boolean filter using the shine:filter --boolean Artisan command.

Each boolean filter contains two methods: apply and options. The apply method is responsible for modifying the query to achieve the desired filter state, while the options method defines the "values" the filter may have.

When building boolean filters, the $value argument passed to the apply method is an associative array containing the boolean value of each of your filter's options.

Let's take a look at an example UserType filter:

The options method should return an array of keys and values. The array's values will be passed into the apply method as the $value argument. This filter defines two possible values: admin and editor.

As you can see in the example above, you may leverage the incoming $value to modify your query. The apply method should return the modified query instance.

Date Filters

You may generate a date filter using the shine:filter --date Artisan command.

Each date filter contains one method: apply. The apply method is responsible for modifying the query to achieve the desired filter state.

When building date filters, the $value argument passed to the apply method is the string representation of the selected date.

Let's take a look at an example CreatedFilter filter:

As you can see in the example above, you may leverage the incoming $value to modify your query. The apply method should return the modified query instance.

Filter Titles

If you would like to change the filter title, you may define a name property on the filter class:

If the name of your filter needs to be dynamic, you should create a name method on the filter class:

Dynamic Filters

There may be times when you want to create a dynamic filter which filters on different columns. In addition to passing the column name that we want to filter on in the constructor, we'll also need to override the key method.

Let's take a look at an example TimestampFilter filter:

When registering the filter on a resource, pass the name of the column you wish to filter on:

Render Filters

By default all defined filter in resource renders by row. Let's take a look at an example:

But you also may want to take filter by key and render it separately. From the example with the UserType filter Let's take how it works by this example:

For get all user selected filters you may use selected method and simple take count. Let's take a look at an example:

Cheat sheet

Credits

Inspired by Laravel Nova

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-resources with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
ext-json Version *
illuminate/support Version 5.5.*||5.6.*||5.7.*||5.8.*
illuminate/console Version 5.5.*||5.6.*||5.7.*||5.8.*
illuminate/http Version 5.5.*||5.6.*||5.7.*||5.8.*
illuminate/view Version 5.5.*||5.6.*||5.7.*||5.8.*
illuminate/database Version 5.5.*||5.6.*||5.7.*||5.8.*
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 tehekone/laravel-resources contains the following files

Loading the files please wait ....