Code Monkey home page Code Monkey logo

laravel-crud's People

Contributors

cerebralfart avatar

Stargazers

 avatar

Watchers

 avatar  avatar

laravel-crud's Issues

Validation of objects

Add possibility to validate changes to objects.

Functionality

  • Only dirty fields should be checked
  • Fields absent in the $validation-array should not be validated

Proposed Syntax

$validation = [
  'email' => 'required|email|unique:users,email',
  'password' => 'required'
];

Touch-policies

It should be possible to check update-policies of related models.

Functionality

  • The relation should be a BelongsTo-relation, HasMany could result in too many checks.
  • The update policy should be checked, regardless of the action being performed (create, update, destroy)

Proposed Syntax

$touches=[
  'user'
];

Rename collection in index action

Currently, the collection is available in the view as $items. It would be more appropriate to base this name on the model name, i.e. $tasks, $users, etc.

Allow filtering with argument

Currently, we only support "boolean" filters, either they are active or they are not. The functionality of the CRUD Controller would be improved by allowing users to pass an argument to their filters, for example to select a range of shirt sizes: _filter[size]=38-42.

If provided, the argument will be forwarded to the filter-function as a string, to prevent accidentally misinterpreting a provided value.

Add whitelisting for order columns

To prevent accidentally exposing private information, the order-columns should be whitelistable. Still unsure about what the default behaviour should be

Full-Text Search

Add the posibility for full text search.

Functionality

  • Match rows against a full-text search term, much like how the current naive search works.

Proposed Syntax

Still to be determined

Filter Query Optimization

The current implementation of applyFilter queries the matching IDs for all active filters. This can be optimized by using a query structure like WHERE id IN (SELECT id FROM table WHERE [filter conditions]).

This should not result in any changes for the developer or end user.

Improve default resolution of arrays

The current default argument resolver uses a shallow is-not-null strategy. This is annoying when resolving data like the view in ViewHelper#view:

$chain = $this->viewMap[$name] ?? static::$defaultViewMap[$name];

Somehow, defining the viewMap should not override keys which are not present, which would allow the code above to be written as:

$chain = $this->viewMap[$name];

Improve exception handling

Currently the application throws a default \Exception. This should at least be an exception custom to the package, or preferably even custom exceptions per error condition.

Pagination of items

The ListAction should support pagination of results, even when filter, search and order are active.

Functionality

  • Implemented using limit/offset-based pagination.
  • Page can be set by the client using the _page parameter, and defaults to 1.
  • Page size can be set by the client using _pageSize parameter, and defaults to the $paginationSize property.

Proposed Syntax

$paginationSize = 15;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.