laravel-4

Getting Variables Passed In URL Laravel

坚强是说给别人听的谎言 提交于 2019-12-21 18:41:44
问题 Probably a basic question but I can't seem to get it. I am wanting to grab the variable in my url to my controller. // index view @foreach ($paymentInfos as $p) <tr> <td><a href="{{ URL::action('AdminController@getPackingSlip', array('order_id' => $p->order_id)) }}"> {{ $p->order_id }}</a></td> <td>{{ $p->lastname }} {{ $p->firstname }}</td> <td>{{ $p->buyer_email }}</td> </tr> @endforeach // route Route::get('printpackingslip', 'AdminController@getPackingSlip'); // Controller class

Getting Variables Passed In URL Laravel

梦想与她 提交于 2019-12-21 18:41:18
问题 Probably a basic question but I can't seem to get it. I am wanting to grab the variable in my url to my controller. // index view @foreach ($paymentInfos as $p) <tr> <td><a href="{{ URL::action('AdminController@getPackingSlip', array('order_id' => $p->order_id)) }}"> {{ $p->order_id }}</a></td> <td>{{ $p->lastname }} {{ $p->firstname }}</td> <td>{{ $p->buyer_email }}</td> </tr> @endforeach // route Route::get('printpackingslip', 'AdminController@getPackingSlip'); // Controller class

Create migration from existing database in Laravel 4

旧巷老猫 提交于 2019-12-21 17:31:04
问题 Is it possible to create a migration in Laravel 4 from an existing database? 回答1: Here is the linked script, that does, what is asked here. I also found this tool (actually a Gist code) and I highly prefer it for its simplicity. 来源: https://stackoverflow.com/questions/23514679/create-migration-from-existing-database-in-laravel-4

Laravel 4 blade templates causing FatalErrorException?

喜你入骨 提交于 2019-12-21 17:27:03
问题 I'm getting an unexplained FatalErrorException when trying to implement a simple page layout using blade templating. I'm not sure if it's something I'm doing wrong or Laravel is. I'm following the tutorial on L4's documentation about Templating and my code seems to follow it. Here's my code. app/routes.php: <?php Route::get('/', 'HomeController@showWelcome'); app/views/home/welcome.blade.php: @extends('layouts.default') @section('content') <h1>Hello World!</h1> @stop app/views/layouts/default

Laravel : Your requirements could not be resolved to an installable set of packages

我是研究僧i 提交于 2019-12-21 17:25:03
问题 I am trying to install Laravel in local system and i am getting error. OS : ubuntu 12.04 LTS Webserver : Nginx PHP : PHP 5.3.10 step 1 : $ git clone https://github.com/laravel/laravel.git my_project step2 : my_project$ composer install I am getting following error. Loading composer repositories with package information Installing dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - laravel/framework v4.2.1 requires php >=5

Add item to select box with an Eloquent collection

北城余情 提交于 2019-12-21 14:32:38
问题 I have a select box on a form which uses data that is listed from an Eloquent model (Laravel 4): $campuses = Campus::lists('name', 'id'); And the form: {{ Form::select('campus_id', $campuses) }} However, I would like to have the first option on the form be Select... so that when the user has not selected an option yet, the first option does not become the default. How can I prepend another option to the beginning of the Eloquent collection? I've tried something like: $campuses = array('Select

Add item to select box with an Eloquent collection

北战南征 提交于 2019-12-21 14:31:46
问题 I have a select box on a form which uses data that is listed from an Eloquent model (Laravel 4): $campuses = Campus::lists('name', 'id'); And the form: {{ Form::select('campus_id', $campuses) }} However, I would like to have the first option on the form be Select... so that when the user has not selected an option yet, the first option does not become the default. How can I prepend another option to the beginning of the Eloquent collection? I've tried something like: $campuses = array('Select

In a Laravel Eloquent model, do we call table field names using camelCase, even though they contain an underscore in the db?

半世苍凉 提交于 2019-12-21 12:37:10
问题 In the database let's say I have in my user's table these fields: name , favorite_color , created_at , etc... Using Eloquent to save: 1: $user = new User; $user->name = "John"; $user->favorite_color = 'blue'; // Notice the underscore $user->save(); 2: $user = new User; $user->name = "John"; $user->favoriteColor = 'blue'; // camelCase $user->save(); Which one of the above is correct? 回答1: The first one is the correct form. But there's a package to help you do the second one: https://github.com

Laravel 4 - Container class: share function & closure logic

非 Y 不嫁゛ 提交于 2019-12-21 12:29:27
问题 I have a follow-up question to the one discussed here: Laravel core method confusion I am in the same situation as driechel (author of question above) has been before, currently getting used to Laravel 4 FW and examining the core. Although a precise answer has been given I still don't understand the logic and what is happening under the hood. So I would very much appreciate a further explanation. I know this might be a duplicate but since I cannot post comments yet I'll give it a shot with a

Changing Laravel Blade Delimiter

三世轮回 提交于 2019-12-21 09:19:10
问题 I know that you can change the default blade delimiter using Blade::setEscapedContentTags('[[', ']]'); Blade::setContentTags('[[[', ']]]'); However I don't know where should I put it so that it only affect single blade template as opposed to putting it at app/start/global.php which affect whole application. 回答1: If you only want to use different tags for a single view, you can set the tags in the closure or controller action that will generate the view. Route::get('/', function() { Blade: