laravel-3

Where can I get a complete list of Laravel events (fired by the core libraries)?

落花浮王杯 提交于 2019-11-30 02:03:27
I want to know what events are fired by Laravel core libraries. I want to get the complete list, such as laravel.query and laravel.done . There are four events listed at the official docs , but I think Laravel has more events than these four! Jason Lewis Laravel doesn't actually fire as many events as you'd think. While it does make use of the Event system it's there for developers to use within there applications. Anyway, here's a list I compiled. laravel.done laravel.log laravel.query laravel.resolving laravel.composing: {viewname} laravel.started: {bundlename} laravel.controller.factory

My Routes are Returning a 404, How can I Fix Them?

北城余情 提交于 2019-11-29 20:32:37
I've just started learning the Laravel framework and I'm having an issue with routing. The only route that's working is the default home route that's attached to Laravel out of the box. I'm using WAMP on Windows and it uses PHP 5.4.3, and Apache 2.2.22, and I also have mod_rewrite enabled, and have removed the 'index.php' from the application.php config file to leave an empty string. I've created a new controller called User : class User_Controller extends Base_Controller { public $restful = true; public function get_index() { return View::make('user.index'); } } I've created a view file in

Getting selected values from a multiple select form in Laravel

丶灬走出姿态 提交于 2019-11-29 17:40:20
问题 For generating a drop-down list with an item selected by default, the following is done: echo Form::select('size', array('L' => 'Large', 'M' => 'Medium', 'S' => 'Small'), 'S'); So I generated a drop-down list that has more than one item selected by default, in the following way: echo Form::select('size', array('L' => 'Large', 'M' => 'Medium', 'S' => 'Small'), array('S', 'M'), array('multiple')); But how do I get the more than one selected values? Input::get('size') returns only the last

Why don't large files download easily in Laravel?

和自甴很熟 提交于 2019-11-28 08:44:58
My file (126 MB size, .exe) is giving me issues. I'm using the standard laravel download method. I tried increasing the memory but it still either says I have run out of memory, or I download a 0 KB size file. The documentation doesn't mention anything about large file sizes. My code is ini_set("memory_limit","-1"); // Trying to see if this works return Response::download($full_path); Anything I am doing wrong? -- Edit -- Going on Phill Sparks comment, this is what I have and it works . It's a a combinations of Phill's plus some from php.net. Not sure if there is anything in there missing?

Check for Session timeout in Laravel

微笑、不失礼 提交于 2019-11-27 18:02:15
I was just wondering if anyone knew how to check for session timeout in Laravel. You can check whether the session has a specific item: if (Session::has('name')) { $name = Session::get('name'); } But you can't check whether the session has expired. It would be nice so that I can report back to the user in a more specific way. "Your session has timed out, please start again." Any thoughts? Just use the same logic as the session class itself. if ((time() - Session::activity()) > (Config::get('session.lifetime') * 60)) { // Session expired } Place this in your 'before' filter - and it will run on

How to use SQL Server connection in Laravel?

南楼画角 提交于 2019-11-27 13:58:17
I got a working project made in Laravel 3 that I have to switch to MsSQL Server (not my call though, sniff...) and I don't understand the Laravel configuration on this database type... I changed the default inside database.php to this 'default' => 'sqlsrv' then I configured the host, database, username, password in the sqlsrv array but then I get this error message: This extension requires the Microsoft SQL Server 2012 Native Client ODBC Driver to communicate with SQL Server` After some research I found that we need PDO of SQLSRV, which I already have as version 5.4 and in my phpinfo I get

Templating in Laravel

柔情痞子 提交于 2019-11-27 11:41:48
I'm trying to get my default template working with Laravel. I'm coming from Codeigniter and Phil Sturgeon's template system so I'm trying to do it in a similar way. Can anyone help me with what I'm missing/doing wrong? Thanks! //default.blade.php (located in layouts/default) <html> <title>{{$title}}</title> <body> {{$content}} </body> </html> //end default.blade.php //home.blade.php (index view including header and footer partials) @layout('layouts.default') @include('partials.header') //code @include('partials.footer') //end home //routes.php (mapping route to home controller) Route:

Laravel - Pass more than one variable to view

橙三吉。 提交于 2019-11-27 10:54:54
I have this site and one of its pages creates a simple list of people from the database. I need to add one specific person to a variable I can access. How do I modify the return $view->with('persons', $persons); line to also pass the $ms variable to the view? function view($view) { $ms = Person::where('name', 'Foo Bar'); $persons = Person::order_by('list_order', 'ASC')->get(); return $view->with('persons', $persons); } Just pass it as an array: $data = [ 'name' => 'Raphael', 'age' => 22, 'email' => 'r.mobis@rmobis.com' ]; return View::make('user')->with($data); Or chain them, like @Antonio

Laravel validation attributes “nice names”

半城伤御伤魂 提交于 2019-11-27 10:25:28
I'm trying to use the validation attributes in "language > {language} > validation.php", to replace the :attribute name (input name) for a proper to read name (example: first_name > First name) . It seems very simple to use, but the validator doesn't show the "nice names". I have this: 'attributes' => array( 'first_name' => 'voornaam' , 'first name' => 'voornaam' , 'firstname' => 'voornaam' ); For showing the errors: @if($errors->has()) <ul> @foreach ($errors->all() as $error) <li class="help-inline errorColor">{{ $error }}</li> @endforeach </ul> @endif And the validation in the controller:

Laravel - Using (:any?) wildcard for ALL routes?

前提是你 提交于 2019-11-27 07:22:57
I am having a bit of trouble with the routing. I'm working on a CMS, and i need two primary routes. /admin and /(:any) . The admin controller is used for the route /admin , and the view controller should be used for anything else than /admin . From the view controller, i will then parse the url and show the correct content. This is what i have: Route::get(array('admin', 'admin/dashboard'), array('as' => 'admin', 'uses' =>'admin.dashboard@index')); Route::any('(:any)', 'view@index'); The first route works, but the second one doesn't. I played around with it a little bit, and it seems if i use (