2017 © Pedro Peláez
 

library laravel-xeditable

x-editable integration with Laravel

image

sudomabider/laravel-xeditable

x-editable integration with Laravel

  • Monday, January 9, 2017
  • by sudomabider
  • Repository
  • 2 Watchers
  • 2 Stars
  • 70 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 25 % Grown

The README.md

A simple package to make xeditable easier to use within Laravel.

Installation

composer require sudomabider/laravel-xeditable

That's it., (*1)

Instructions

  • Have your x-editable based requests extend Sudomabider\LaravelXEditable\XEditableRequest. This class will first validate the initial request to make sure it's a valid x-editable request, and then rearrange the request parameters into a normal form request, e.g. from {name: 'gender', value: 'male'} into {gender: 'male'}, (*2)

  • You may restrict the names allowed from a request, (*3)

    protected function allowedEditableNames()
    {
        return ['name', 'gender', 'email'];
    }
    

    This is particularly useful when multiple x-editable requests are grouped into a single class., (*4)

  • Define validation rules as you would in a normal form request:, (*5)

    public function rules()
    {
        return [
            'email' => 'required|email'
        ];
    }
    

    You may want to return different rules depending on which parameter is present:, (*6)

    public function rules()
    {
        if ($this->exists('email')) {
            return [
                'email' => 'required|email'
            ];
        }
    
        if ($this->exists('name')) {
            return [
                'name' => 'required|min:3'
            ];
        }
    }
    

The Versions

09/01 2017

dev-master

9999999-dev

x-editable integration with Laravel

  Sources   Download

MIT

The Requires

 

by Avatar sudomabider

09/01 2017

0.1

0.1.0.0

x-editable integration with Laravel

  Sources   Download

MIT

The Requires

 

by Avatar sudomabider