Giter Site home page Giter Site logo

framework's Introduction

Build Status Total Downloads Latest Stable Version License

About Laravel

Note: This repository contains the core code of the Laravel framework. If you want to build an application using Laravel, visit the main Laravel repository.

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as:

Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation gives you a complete toolset required to build any application with which you are tasked.

Learning Laravel

Laravel has the most extensive and thorough documentation and video tutorial library of any modern web application framework. The Laravel documentation is in-depth and complete, making it a breeze to get started learning the framework.

You may also try the Laravel Bootcamp, where you will be guided through building a modern Laravel application from scratch.

If you're not in the mood to read, Laracasts contains thousands of video tutorials covering a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library.

Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.

Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

License

The Laravel framework is open-sourced software licensed under the MIT license.

framework's People

Contributors

anlutro avatar antonkomarev avatar axlon avatar barryvdh avatar browner12 avatar crynobone avatar deleugpn avatar driesvints avatar dwightwatson avatar franzliedke avatar grahamcampbell avatar iamgergo avatar imanghafoori1 avatar josephsilber avatar kennedytedesco avatar laurencei avatar lucasmichot avatar mnabialek avatar nunomaduro avatar paras-malhotra avatar sileence avatar sjorso avatar staudenmeir avatar stylecibot avatar taylorotwell avatar tblindaruk avatar themsaid avatar tillkruss avatar timacdonald avatar vlakoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

framework's Issues

FatalErrorException when registering service provider on workbench package

I ran through the workbench utility to create a new package (Foo\Bar), ran composer install, and registered the Foo\Bar\BarServiceProvider in my app.providers config array.

Upon loading the site up in a browser, I get the following error:

FatalErrorException: Error: Class 'Foo\Bar\BarServiceProvider' not found in /Users/aaron/Sites/laravel-4/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php line 123

I've re-read the docs and tried creating a few different packages, but get the same result each time. Also tried tracking down what could be the issue, but no luck. Am I missing a step, or is this a confirmed bug? I'm using MAMP Pro 2.1.1 and PHP 5.4.4.

Thanks for any help or input!

[BUG] PHPUnit Fails when new Service Provider is added

I used a fresh L4 install,
generated a workbench package
added the package service provider to config/app.php file under providers key
Then ran phpunit and test is not running.

Then I removed the service provider from the array and phpunit worked.

phpunit_workbench

It seems something wrong with autoloading the extended class Illuminate\Foundation\Testing\TestCase
as if I extend the class with PHPUnit_Framework_TestCase then it does work.

Resourceful URL generation

I think that it'd be good to have the URL class able to generate resourceful links to match resourceful routing.

Maybe something like URL::resource(resource route, parameters)

Resource Routes for a user: userIndex, userCreate, userStore, userShow, userEdit, userUpdate, userDestroy

URL::resource('userCreate')
URL::resource('userEdit', $user->id)

Workbench placeholder not replaced.

I was going to submit a pull for this but there's a number of ways it could be resolved. So I thought I'd leave it up to you to decide Taylor.

When you generate a package with the workbench the generated service provider does not replace {{full_package}}. It's not part of the objects variables so it's never included.

Request: any and all routes

Well in L3 we could redirect any user request to a custom controller using Route::any('(:any), (:any)/(:all)', 'mycontroller@index');
With the changes in L4 i kinda see this idea lost, so please (re)implement the feature in L4.
I don't know a beautiful alternative to that problem in L4, i guess i could listen for 404 pages, get the values of the URL myself and start over there, but that's an ugly solution, if anyone knows any better ways, please tell me.

[Request] Object routing

It would be awesome if you were able to just pass model objects instead of arrays when generating routes. That would allow for complete flexibility when generating routes, without having to worry about changing the parameter array that is passed everywhere where URLs are generated.

In relation to these issues:
symfony/symfony#5999
illuminate/database#38

(Meaning I've raised this at the Symfony routing level and tried to implement ArrayAccess for models, which should simplify this).

[Bug] Config::has() does not work properly

For a non-existing config file named 'key.php', Config::has('key') returns true.

That's because Input::get('key') returns an empty array, which is different than the default value generated in the has() method.

The logic of that method could be improved to really check for the existence of such an element.

Possible [Bug] Workbench Package

I have fresh installation of L4 beta.
Created a workbench package.
Applied composer update to the package.
Registered the Package Service Provider in App/Config file.
Refreshed home page and got this error.

ReflectionException: Class translator does not exist
in /Users/raf/Sites/hbt2013/L4/app/vendor/laravel/framework/src/Illuminate/Container/Container.php line 274
at ReflectionClass->__construct('translator') in /Users/raf/Sites/hbt2013/L4/app/vendor/laravel/framework/src/Illuminate/Container/Container.php line 274
at Container->build('translator', array()) in /Users/raf/Sites/hbt2013/L4/app/vendor/laravel/framework/src/Illuminate/Container/Container.php line 218
at Container->make('translator', array()) in /Users/raf/Sites/hbt2013/L4/app/vendor/laravel/framework/src/Illuminate/Foundation/Application.php line 261
at Application->make('translator') in /Users/raf/Sites/hbt2013/L4/app/vendor/laravel/framework/src/Illuminate/Container/Container.php line 401
at Container->offsetGet('translator') in /Users/raf/Sites/hbt2013/L4/app/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php line 77
at ServiceProvider->package('raftalks/assets') in /Users/raf/Sites/hbt2013/L4/app/workbench/raftalks/assets/src/Raftalks/Assets/AssetsServiceProvider.php line 21
at AssetsServiceProvider->register() in /Users/raf/Sites/hbt2013/L4/app/vendor/laravel/framework/src/Illuminate/Foundation/Application.php line 230
at Application->register(object(AssetsServiceProvider)) in /Users/raf/Sites/hbt2013/L4/app/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php line 67
at ProviderRepository->load(object(Application), array('Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Auth\AuthServiceProvider', 'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Foundation\Providers\CommandCreatorServiceProvider', 'Illuminate\Foundation\Providers\ComposerServiceProvider', 'Illuminate\Routing\ControllerServiceProvider', 'Illuminate\Cookie\CookieServiceProvider', 'Illuminate\Database\DatabaseServiceProvider', 'Illuminate\Encryption\EncryptionServiceProvider', 'Illuminate\Filesystem\FilesystemServiceProvider', 'Illuminate\Hashing\HashServiceProvider', 'Illuminate\Log\LogServiceProvider', 'Illuminate\Mail\MailServiceProvider', 'Illuminate\Database\MigrationServiceProvider', 'Illuminate\Pagination\PaginationServiceProvider', 'Illuminate\Foundation\Providers\PublisherServiceProvider', 'Illuminate\Redis\RedisServiceProvider', 'Illuminate\Database\SeedServiceProvider', 'Illuminate\Foundation\Providers\ServerServiceProvider', 'Illuminate\Session\SessionServiceProvider', 'Illuminate\Foundation\Providers\TinkerServiceProvider', 'Illuminate\Translation\TranslationServiceProvider', 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'Illuminate\Workbench\WorkbenchServiceProvider', 'Raftalks\Assets\AssetsServiceProvider')) in /Users/raf/Sites/hbt2013/L4/app/vendor/laravel/framework/src/Illuminate/Foundation/start.php line 184
at require('/Users/raf/Sites/hbt2013/L4/app/vendor/laravel/framework/src/Illuminate/Foundation/start.php') in /Users/raf/Sites/hbt2013/L4/app/start.php line 59
at require_once('/Users/raf/Sites/hbt2013/L4/app/start.php') in /Users/raf/Sites/hbt2013/L4/app/public/index.php line 53

I think this is happening because the translator is trying to load the language files from the lang directory of the package when it is empty.

When I removed the package lang directory which gives a temporary solution. I am not sure but I think this is the problem.

[Proposal] Include route parameters as key/value pairs in Input

This is a technique I'm using on a project recently and and find the idea to be useful.

Consider the route:

Route::get('/products/{productType}/{category}', array('uses' => 'ProductsController@showProducts'));

and the URL requested

    http://example.dev/products/tickets/conference?keyword=laracon

This is my current implementation strung together but I'd expect the final implementation to be in the Router/Route classes somewhere... just to illustrate the idea:

public function __construct()
{
    $this->router = App::__get('router');

    $currentRoute = $this->router->getCurrentRoute();

    $keys = $currentRoute->compile()->getVariables();
    $vars = $currentRoute->getVariables();

    $params = array();

    if (! empty($keys)) {
        $params = array_combine($keys, $vars);  
    }

    $allInput = Input::all();

    $this->parameters = new Illuminate\Support\Fluent($params);
    $this->input = new Illuminate\Support\Fluent(array_merge($params, $allInput));

}

public function showUser()
{
    $this->input->get('productType'); // productType as part of the route URI
    $this->input->get('category'); // category as part of the route URI
    $this->input->get('keyword'); // keyword as query string parameter
}

The first payoff is that accessing route variables and input variables by the same method is convenient. Secondly, the controller and application becomes aware of the key/value pairs given by route (without using something ugly like func_get_args() in every single method call).

Migration doesn't account for prefix when checking if migration table exists [bug]

Original bug found here: https://github.com/illuminate/database/issues/111 - Moved to his repo as per Taylor. Here's the original text:

I spoke with Machuga in IRC - It was suggested I create an issue.

Issue:

Error after first migration: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'up_migrations' already exists

Steps to reproduce:

  1. Fresh install of L4
  2. Add a prefix to database in database connection config (MySql)
  3. Create a migration $ php artisan migrate:make create_users_table --table=users --create
  4. Fill in some fields, run the migration $ php artisan migrate
  5. Attempt a migrate:refresh $ php artisan migrate:refresh
  6. ERROR: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'up_migrations' already exists

Relevant files:

I tracked this down to this file: Illuminate\Database\MigrationsDatabaseMigrationRepository::repositoryExists() and specifically within that, the call to return $schema->hasTable($this->table); here

The $this->table variable passed to hasTable() does not include the table prefix. Illuminate\Database\Schema\MySqlBuilder::hasTable($table) does not check for prefix either.

Unfortunately I'm not yet familiar with the code/convention to know where you'd prefer to look up the prefix. (Not sure what class should have that "knowledge")

App::abort(404) not listening to custom error handler

I'm using App::abort(404); to force a 404 however I'm getting the standard stack trace and Laravel doesn't seem to listen to the following error handler I've added to app/start/global.php

App::missing(function($exception)
{
    return View::make('errors.404');
});

Reverse routing with Route::controller()

This may be intentional but I thought I'd bring it up just to double check.

If you use Route::controller() you can't use reverse routing for any of the actions on the controller. I believe this is because UrlGenerator::action() simply compares the _uses option of the route against the action provided. The requirements for a route aren't actually expanded.

A solution would be to convert the requirements into their regular expression equivalents and then compare the actions.

[Proposal] Eloquent Collections functional enhancements

Propose to add the following interface to Collection class

/**
 * @method each()
 * @method filter()
 * @method slice()
 * @method sort()
 * @method hasAny()
 * @method any()
 */

This should allow for easier manipulation of collections with closures

These functions are well known and there use should be reasonably easy to guess. An example implementation might look like the following(obviously will need to be adjusted for Laravel coding standards if approved to move forward)

<?php namespace Illuminate\Database\Eloquent;

class Collection{ use FunctionalCollectionsTrait; }

trait FunctionalCollectionsTrait
{

    /**
     * Run a function over every item
     *
     * @param  Closure  $closure
     * @return bool
     */

    public function each(Closure $closure)
    {
        $this->items = array_map($closure, $this->items);
    }

    /**
     * Filter items in collection with closures
     * (keep if return true, delete if return false)
     *
     * @param  Closure  $closure
     * @return void
     */

    public function filter(Closure $closure)
    {
        $this->items =  array_filter($this->items, $closure);
    }

    /**
     * @param int $offset
     * @param int $length
     */
    public  function slice($offset, $length = 0)
    {
        if($length == 0)
            $this->items = array_slice($this->items, $offset);
        else
            $this->items = array_slice($this->items, $offset, $length);
    }


    /**
     * Sort collection by the value returned from the closure
     *
     * @param Closure $closure
     * @param string  $direction
     *
     * @return void
     */
    public function sort(Closure $closure, $direction = 'ASC')
    {
        foreach($this->items as $item)
        {
            $key = $closure($item);
            $sortable[$key] = $item;
        }
        $direction = (strtolower($direction) == 'desc') ? SORT_DESC : SORT_ASC;
        if ($direction == SORT_ASC) ksort($sortable);
        else krsort($sortable);

        $this->items = array_values($sortable);
    }

    /**
     * Check if any item matches a truth test
     *
     * @param Closure $closure
     *
     * @return bool
     */
    public function hasAny(Closure $closure)
    {
       foreach($this->items as $item)
       {
           if($closure($item)) return true;
       }
       return false;
    }

    /**
     * Determine if the collection is empty or not.
     *
     * @return bool
     */
    public function isEmpty()
    {
        return empty($this->items);
    }

}

[Bug] SQLite multiple inserts need to be broken down to chunks of 100

Currently SQLite multiple inserts only work with chunks of 100 entries. Above it, it throws the following exception : SQLSTATE[HY000]: General error: 1 too many SQL variables.
Something with array_chunk maybe.

This isn't a problem in most parts of the application since inserts can be manually splited but is hugh problem in seeds because even if you split the query and insert the first chunks beforehand, seeding empties the database before inserting the seeded values.


UPDATE : Apparently this isn't as much a matter of entries as a matter of placeholders. See the #9 of this page on the SQLite website for more details. So if you insert entries with 5 columns (id, name, description, created_at, updated_at) you can insert 999 / 5 = 199 entries.
Maybe check if the limit can be put higher via PHP.

"Permission denied" on Log via CLI and Apache Deamon might be frequent

If you are running your php cli as a user different than apache, you'll get frequent permission denied errors and lately this was driving me crazy every time I used migration:rollback. I was having to delete migrations rows and/or drop tables to correct the migrations state.

I just added in (global.php) the php SAPI name to solve it in my end:

Log::useDailyFiles(__DIR__.'/../storage/logs/log-'.php_sapi_name().'.txt');

But it could be a better way to do that with Monolog...

[Request] Create a DB:: unprepared command

I was trying to create a trigger using migrations after trying everything I discovered that all DB:: commands are under a "prepare" condition and some MySQL commands cannot run, actually if you are using DB::exec you don't have to prepare at all if you don't have variables to resolve.

This is what I was trying to do: http://paste.laravel.com/fIa

This is the error MySQL gives: [PDOException] SQLSTATE[HY000]: General error: 2030 This command is not supported in the prepared statement protocol yet

I think it would be great to have an unprepared statement on DB::

Using getPDO made it work fine for me: http://paste.laravel.com/fIh

[Request] Nested resources

I don't know if this any of this is planned, but:

  1. How about nested resources?
resources :magazines do
  resources :ads
end
  1. How about ability to add custom methods to resourceful controllers:
resources :photos do
  member do
    get 'preview'
  end
end

I've quoted rails here. Hope that's okay. I'm sorry if these features are already here - I just didn't find them in the code or docs. I'd be happy to help with implementation.

Possible [Bug]: Wrong value returned while retrieving lines from language file

I just noticed that when 'key' and 'value' are the same in language files, the Lang class returns the key instead of the existing value.

Line in Language file (/app/lang/en/test.php):

'rabbit' => 'rabbit'

Retrieving the line:

return Lang::get('test.rabbit');

Result:

'test.rabbit'

As if the language key doesn't exists.

[Request] Command for clearing cache

How about an Artisan command for automatically deleting all kinds of cache files (or even separate ones for the different cache types)? And the services.json file, too.

[Bug] BindingResolutionException: Unresolvable dependency resolving

I'm trying to use dependency injection as explained in the docs. My controller has the following construct :

<?php
class Projects extends BaseController
{
  public function __construct(Project $projects)
  {
    $this->projects = $projects;
  }

And here is the Project model :

<?php
class Project extends Eloquent {}

In my head this was supposed to work but somehow here is the Exception that is thrown :

BindingResolutionException: Unresolvable dependency resolving [Parameter #0 [ array $attributes = Array ]].
in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Container\Container.php line 327
at Container->getDependencies(array(object(ReflectionParameter))) in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Container\Container.php line 301
at Container->build('Project', array()) in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Container\Container.php line 218
at Container->make('Project', array()) in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Foundation\Application.php line 261
at Application->make('Project') in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Container\Container.php line 330
at Container->getDependencies(array(object(ReflectionParameter))) in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Container\Container.php line 301
at Container->build('Projects', array()) in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Container\Container.php line 218
at Container->make('Projects', array()) in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Foundation\Application.php line 261
at Application->make('Projects') in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Routing\Router.php line 573
at Router->Illuminate\Routing\{closure}()
at call_user_func_array(object(Closure), array()) in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Routing\Route.php line 64
at Route->callCallable() in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Routing\Route.php line 39
at Route->run(object(Request)) in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Routing\Router.php line 658
at Router->dispatch(object(Request)) in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Foundation\Application.php line 369
at Application->dispatch(object(Request)) in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\vendor\laravel\framework\src\Illuminate\Foundation\Application.php line 349
at Application->run() in C:\Users\Maxime\Dropbox\WEB DESIGN\taketime-illuminate\public\index.php line 67

Can't Eloquent models be injected automatically like this ?

[Request] Ability to rename the public folder

Would be great to be able to rename the public directory. For example in my hosting environment I use 'content' rather than 'public'. I'm sure lots of setups use other names such as httpdocs, public_html, etc

Or am I missing something and this already exists?

[Request] Allow seeds to be classes

As discusses here I truly think more control and cleaner seeds should be available for advanced uses via the ability to use classes in seed files.
Which would also make the defining of a table for the seed cleaner when you rename the seeds to load them in a specific order.

[Proposal] Improve BCrypt hashing component.

Seeing as other Laravel components are leveraging some of the best PHP libraries available, it seems like the BCrypt hashing component should do the same. I recommend making it leverage either Kherge/BCrypt or Password Compat.

They both have a better selection of salt generators (MCrypt, OpenSSL, DevRandom, Microsoft CryptoAPI) and select the best available in the environment, falling back to the next most secure salt generator (until eventually it'll use plain old MtRand). They also switch between BCrypt versions 2a and 2y depending on the version of PHP running because 2a has a security issue. Additionally they're well tested.

It's worth reading Anthony Ferrara's article about screwing up BCrypt as it highlights some of the common mistakes (a few of which exist in the current L4 implementation).

Cannot Access some $App components inside ServiceProvider

I have created a basic workbench package and I am trying to inject Auth class instance to the main class of the package. It seems some of the components like Auth, Log, are not available inside the register method when using $this->app['auth'] or $this->app['log'].

It seems they are not loaded when the register method is called on service provider of workbench package.

I am getting the following errors
ReflectionException: Class auth does not exist
ReflectionException: Class log does not exist

This is the Service Provider Class I am using

<?php namespace Hbt\Acl;

use Illuminate\Support\ServiceProvider;

class AclServiceProvider extends ServiceProvider {

    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->package('hbt/acl');
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
                $log = $this->app['log'];
                $auth = $this->app['auth'];
        $this->app['acl'] = new Acl($auth , $log);
    }

....

[Proposal] Overriding routes by order of declaration.

When a route is added the name generated is appended with microtime(true). This will mean that the first route to be declared will always be given precedence. Should it not be the order in which the two identically named routes are defined.

Currently:

Route::get('/', function()
{
    return 'This one will be run.';
});

Route::get('/', function()
{
    return 'This does not work. The first route is used.';
});

This may be intentional but it makes it really hard to override a route.

Class autoloading doesn't loads migration classes

Autoloading was recently re-introduced to prevent us from having to run composer dump-autoload every time. See this commit.

But it seems this was only done for controllers and models. When I try to run a migration it still gives a Fatal error saying it didn't find the migration class:

PHP Fatal error:  Class 'CreateUsersTable' not found in foo/bar

Running composer dump-autoload fixes the problem.

I've tried adding the migrations folder to the array of folders here in app/start/global:

ClassLoader::register(new ClassLoader(array(

    app_path().'/controllers',
    app_path().'/models',
    app_path().'/database/migrations',

)));

Sadly that doesn't seems to be the solution.

Any suggestions...?

[Request] Add methods to Paginator::make() which will return "current" items

From my understanding of the Paginator class right now, when you want to use make() to paginate custom data not from Eloquent (in my case it's from Mongo), it doesn't actually handle returning the subset of data to be displayed on the current page.

Current code:

$perPage = 50;
$paginator = Paginator::make($data, count($data), $perPage);
$currentPage = Paginator::getCurrentPage();
$pagedData = array_slice($data, $currentPage * $perPage, $perPage);
// Pass $paginator and $pagedData to view

Wanted code:

// Remove count() call since we could just call it in the make() method
$paginator = Paginator::make($data, $perPage);
// Pass $paginator to view

Then in the view:

@foreach ($paginator->getRows() as $row)
    {{ $row->column }}
@endforeach

Currently getItems() just returns the items you put into the first argument of make(), so probably add getRows() or something similar to get the data which would just be an array_slice() call or similar.

Thoughts? Am I missing something in the current functionality?

[Request] Implement automated read/write connections in Eloquent

For those we use master/slave connections in our applications it will be cool to have some way we can setup so Eloquent auto-detects it.

There is various scenarios on how this can be implemented but a basic SELECT => slave connection, INSERT, DELETE, UPDATE => master will be fantastic.

Thanks!

[Request] Custom commands for packages

Currently the neither the Workbench nor the ServiceProvider->package() method prepare the ground for custom commands in packages, and the doc doesn't mention them on the packages section.
Could there be a way to make the developping of custom commands easier for packages ?

[Query] Trailing slash doesn't match routes.

Just a simple one. I tried creating the following route:

Route::get('hello', function()
{
    return View::make('hello');
});

But this route is then only accessible at example.com/hello and not example.com/hello/, which throws a NotFoundHttpException. Obviously, creating the route for hello/ then means the route is no longer accessible at 'example.com/hello'. This is exactly what is supposed to happen, since the route didn't match, but it might not be what is expected to happen.

Type any URL on the Laravel 4 documentation site, absent-mindedly include a trailing slash, and you won't find the page.

This could be a feature when creating RESTful APIs (when a URI resource with a trailing slash is considered different from one without), but for standard navigation it could be a common query; especially since "Pretty URLs" commonly append a trailing slash for neatness.

To avoid this, users could simply define routes twice, in my case, for both hello and hello/.

Route::get('hello', function()
{
    return View::make('hello');
});
Route::get('hello/', function()
{
    return Redirect::to('hello')
});

However, I'm pretty sure doing this for every route for which a trailing slash could be a possibility would be quite annoying. On the other hand, you also wouldn't want to assume and use the .htaccess file to automatically add the slash automatically to all routes.

tl;dr Not sure if bug or feature, and merely a 'gotcha' for new users.

Resourceful vs restful controller routing

Are we switching to resourceful routing over restful routing for any particular reason?
Is there a reason why they can't both exist?
Are we worried that this will make the framework less accessible?

Thanks.

Unable to get all items of a package config

I've created a package with it's own config file ... I can retrieve an item of this configuration with :

Config::get('package::config_key')

but I cannot retrieve all items of this package using :

Config::get('package')

After this I think that can be useful add this tip to the docs

[Issue] Getting weird characters after upload

I just uploaded Laravel 4 Beta 1 to my webserver which is hosted by namecheap and the first thing i get is this:

http://avalon.envogrid.com/public_html/

What could these unknown charaters be?

PS: I didn't change anything in the source code, just edited the KEY and that's it i guess.

I also checked the requirments by Laravel and my hosting server meets them all.

PHP 5.3+
and MCrypt is supported

ReflectionException

In PHP5.4.9 all controllers get this error:
ReflectionException: Class TestController does not exist

But in PHP5.4.8 the same code runs successfully

Migration of workbench package does not work.

running

php artisan migrate --bench=vendor/package

fails with

PHP Fatal error:  Class 'CreateContentTables' not found in /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php on line 290
PHP Stack trace:
PHP   1. {main}() /home/mgb/src/laravel4/laravel/artisan:0
PHP   2. Symfony\Component\Console\Application->run() /home/mgb/src/laravel4/laravel/artisan:73
PHP   3. Symfony\Component\Console\Application->doRun() /home/mgb/src/laravel4/laravel/vendor/symfony/console/Symfony/Component/Console/Application.php:106
PHP   4. Illuminate\Console\Command->run() /home/mgb/src/laravel4/laravel/vendor/symfony/console/Symfony/Component/Console/Application.php:193
PHP   5. Symfony\Component\Console\Command\Command->run() /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php:95
PHP   6. Illuminate\Console\Command->execute() /home/mgb/src/laravel4/laravel/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:240
PHP   7. Illuminate\Database\Console\Migrations\MigrateCommand->fire() /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php:107
PHP   8. Illuminate\Database\Migrations\Migrator->run() /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:67
PHP   9. Illuminate\Database\Migrations\Migrator->runMigrationList() /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:84
PHP  10. Illuminate\Database\Migrations\Migrator->runUp() /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:113
PHP  11. Illuminate\Database\Migrations\Migrator->resolve() /home/mgb/src/laravel4/laravel/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:130

if I add the path

workbench/vendor/package/src/migrations

To autoload.classmaps in composer.json it works fine.
I havn't tested it but I am sure composer packages in vendor/ will have the same problem.

Controller class name vs file name

L4 it seems that your controller class cannot be called something like 'Auth.php' - must be 'AuthController.php' Class name must match file name, unlike L3 you could have 'Auth.php' class name 'Auth_Controller'.

This means when generating a URL, 'AuthController@login' must be used as opposed to 'auth@login' which was legal in L3.

[Request] Allow other query methods in Eloquent eager loading closure

Currently, we can only use WHERE clauses in closures when eager loading. Like:

$users = User::with(array('posts' => function($query)
{
$query->where('title', 'like', '%first%');

}))->get();

Maybe allowing ORDERBY, LIMIT, OFFSET etc... will be a good idea? So we will have more control when eager loading something using Eloquent.

Something like:

$users = User::with(array('posts' => function($query)
{
$query->orderBy('created_at', 'desc');

}))->get();

[Proposal] Remove the trailing slash in URL

With the following URLs:

http://myapp.dev/admin
http://myapp.dev/admin/users

I can’t “hack” the URL by removing the users part of the second one, a 404 will be triggered because of the trailing slash:

http://myapp.dev/admin/

I think that “hackable URLs” are a nice way to interact with an application.

Proposal

The Router class could handle this: if a route is not matched, but the path ends with a slash, then try again to match the route after removing the trailing slash.

If the route exists, then redirect to the correct route, without trailing slash. Or maybe don’t even redirect, like GitHub does (it could be a setting):

https://github.com/laravel/framework/issues
https://github.com/laravel/framework/issues/

Router->dispatch() could handle this, or maybe Router->handleRoutingException().

[Proposal] Verbosity added to Console\Command wrappers

There is no simply way I see with Symfony's Console components to only write if --verbose is set. I have had to do a heap of if ($this->verbosity() > 1) to get the effect myself. So I propose you add a second variable to your wrapper methods in Console\Command... as in info($string), error($string) etc. Simply add an optional second variable to only output if a certain verbosity is set.

I have already done it on an App I am making that uses your console component.
https://github.com/bigelephant/xf-console/blob/master/src/BigElephant/XfConsole/Command.php

[Request] Allow error handlers to be overridden

There are certain cases where I think developers may want to override previously defined error handlers. For example, let's say I have my main app, and also a REST API. I may want to define a 404 handler for the main app that displays a page:

App::missing(function($e)
{
    return Response::make(View::make('errors.404'), 404);
});

If the request is to one of my API's routes though, I might want my 404s to do this:

App::missing(function($e)
{
    return Response::json([
        'error' => 'Method not found',
    ], 404);
});

From what I can tell, there is no way to override the default 404 handler if the request is to an API route. This was possible in L3 with Event::override() and it would be awesome to get an equivalent in L4.

Thanks for the consideration!

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.