Download the PHP package dgoring/laravel-inherit-resource without Composer

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

Laravel Inherit Resource

Inspired by the ruby gem InheritResource

I bring you quick minimalist resource controllers in laravel

Basic usage

Simply place resource trait in your controller

with the resource route in your routes file

And all the resource functions are placed and run against the class as well as loading the views

all settings are assumed by the name of the controller so UsersController is assumed to use

the query

To override the query used for say filtering the index page you can override the collection function

The collection function is also used for all resource functions to give the base query So can be used to filter content across the controller

Authorized Resource

By default all the actions are put through the authorize function, so you can control access to this resource

Validation rules

You can specify validation rules for the store and update functions but defining validationRules function

nested resource

Nested resources are just as easy

Simply setup your route

And return the relationship in the collection function

as the collection function is used for the create and store functions as long as your return the relationship from the parent model the relationship should be saved to the new record and it should also already be in the model in the create view variable

JSON

this resource is also ready to respond to json requests note that the index will return a total count in the response headers as Count

also if defined in a appropriate place a JsonCollection or JsonResource formatter will be used for the model i.e.

And you can also allow only JSON responses

or only HTML

Overrides

Namespaces

By default models are assumed to be under the App namespace but you can change that by adding the file config/inherit_resource.php

below shows the config file for App\Models

and also the namespaces for the json resources and collections

Controller variables

Responses

these response functions can be overridden to allow you to have completely custom responses to certain actions without having to override the entire route function



class UsersController extends Controller
{
  use Resource;

  protected function htmlIndex();
  protected function htmlShow();
  protected function htmlCreate();
  protected function htmlStoreSuccess();
  protected function htmlStoreFailure();
  protected function htmlEdit();
  protected function htmlUpdateSuccess();
  protected function htmlUpdateFailure();
  protected function htmlDestroySuccess();
  protected function htmlDestroyFailure();

  protected function jsonIndex();
  protected function jsonShow();
  protected function jsonStoreSuccess();
  protected function jsonStoreFailure();
  protected function jsonUpdateSuccess();
  protected function jsonUpdateFailure();
  protected function jsonDestroySuccess();
  protected function jsonDestroyFailure();
}

All versions of laravel-inherit-resource with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3|^8.0
laravel/framework Version ^7.0|^8.0|^9.0|^10.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 dgoring/laravel-inherit-resource contains the following files

Loading the files please wait ....