2017 © Pedro Peláez
 

library photoable

Assign one or many photos to any Eloquent model

image

hscomp/photoable

Assign one or many photos to any Eloquent model

  • Sunday, February 26, 2017
  • by hscomp
  • Repository
  • 0 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Laravel Photoable

Installation

Add next code to your composer.json file and write composer update., (*1)

    "require": {
        "hscomp/photoable": "dev-master"
    },

To use this package, add its service provider to your config/app.php providers array., (*2)

    'providers' => [
        // ... 
        Hscomp\Photoable\PhotoableServiceProvider::class,
    ],

Usage

The ServiceProvider will add a new command routes:javascript to your artisan commands. By default, this command will generate a routes.js file on your resources/assets/js folder. This contains all named routes in your app. That's it! You're all set to go., (*3)

$ php artisan routes:javascript

Lazy Tip If you use elixir (or any js task manager), set up a watcher that runs this command whenever your php routes change., (*4)

Arguments

Name Default Description
name routes.js Output filename

Options

Name Default Description
path resources/assets/js Where to save the generated filename, relative to the base path. (ie. "public/assets" folder if you don't plan to mix it.)
middleware null If you want only some routes to be available on JS, you can use a middleware (like js-routable) to select only those
object Router If you want to choose your own global JS object (to avoid collision)
prefix null If you want to a path to prefix to all your routes

Javascript usage

By default, the command will generate a routes.js file on your resources/assets/js folder, so you can use elixir:, (*5)

elixir(function(mix){
    mix.scripts([
        'routes.js',
        'app.js'
    ]);
});

You may generate the routes file in your public folder instead..., (*6)

php artisan routes:javascript --path public/js

...then include it in your views:, (*7)

<script src="/js/routes.js" type="text/javascript">

In any case, you'll have a Routes object on your global scope., (*8)

Examples:, (*9)

// Usage: Router.route(route_name, params)
Router.route('users.show', {id: 1}) // returns http://dommain.tld/users/1

// If you assign parameters that are not present on the URI, they will get appended as a query string:
Router.route('users.show', {id: 1, name: 'John', order: 'asc'}) // returns http://dommain.tld/users/1?name=John&order=asc

Contributing

This project uses phpunit for php testing and jasmine for JS testing. Check available grunt tasks in the Gruntfile.js file., (*10)

Found a bug?

Please, let us know! Send a pull request (better) or create an issue. Questions? Ask! We will respond to all issues., (*11)

Inspiration

Although no code was copied, this package is greatly inspired by FOSJsRoutingBundle for Symfony., (*12)

License

This package is open-sourced software licensed under the MIT license, (*13)

The Versions

26/02 2017

dev-master

9999999-dev

Assign one or many photos to any Eloquent model

  Sources   Download

MIT

The Requires

 

by Petr Zavicak

laravel upload photos