laravel-3

Add a new column to existing table in a migration

本秂侑毒 提交于 2019-11-27 05:47:51
I can't figure out how to add a new column to my existing database table using the Laravel framework. I tried to edit the migration file using... <?php public function up() { Schema::create('users', function ($table) { $table->integer("paid"); }); } In terminal, I execute php artisan migrate:install and migrate . How do I add new columns? Phill Sparks To create a migration, you may use the migrate:make command on the Artisan CLI. Use a specific name to avoid clashing with existing models for Laravel 3: php artisan migrate:make add_paid_to_users for Laravel 5+: php artisan make:migration add

Laravel 3 : Looking for explanation how to use the model

半城伤御伤魂 提交于 2019-11-27 05:32:04
I'm new at MVC and my first framework is Laravel (3 for now). I've started coding exclusively in the routes, and I moved to the controller. I'm however doing all of my database operations in the controller. I do not understand how to use the model. Examples either demonstrate everything in the controller or in the route, but they never split the model, controller and view. Could anyone kindly explain me how to use the model? In short I don't understand how to link one to each other, like sending form input to them model, or processed data back to the controller. A github repo of a Laravel (v3

Why don't large files download easily in Laravel?

帅比萌擦擦* 提交于 2019-11-27 02:25:04
问题 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

Laravel validation attributes “nice names”

六眼飞鱼酱① 提交于 2019-11-26 17:57:18
问题 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

How to use SQL Server connection in Laravel?

落花浮王杯 提交于 2019-11-26 16:35:21
问题 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

Templating in Laravel

前提是你 提交于 2019-11-26 15:41:04
问题 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

Laravel 3 : Looking for explanation how to use the model

房东的猫 提交于 2019-11-26 11:37:01
问题 I\'m new at MVC and my first framework is Laravel (3 for now). I\'ve started coding exclusively in the routes, and I moved to the controller. I\'m however doing all of my database operations in the controller. I do not understand how to use the model. Examples either demonstrate everything in the controller or in the route, but they never split the model, controller and view. Could anyone kindly explain me how to use the model? In short I don\'t understand how to link one to each other, like

How to do this in Laravel, subquery where in

廉价感情. 提交于 2019-11-26 07:27:09
How can I make this query in Laravel: SELECT `p`.`id`, `p`.`name`, `p`.`img`, `p`.`safe_name`, `p`.`sku`, `p`.`productstatusid` FROM `products` p WHERE `p`.`id` IN ( SELECT `product_id` FROM `product_category` WHERE `category_id` IN ('223', '15') ) AND `p`.`active`=1 I could also do this with a join, but I need this format for performance. lukaserat Consider this code: Products::whereIn('id', function($query){ $query->select('paper_type_id') ->from(with(new ProductCategory)->getTable()) ->whereIn('category_id', ['223', '15']) ->where('active', 1); })->get(); drewjoh Have a look at the advanced

How to do this in Laravel, subquery where in

三世轮回 提交于 2019-11-26 01:58:25
问题 How can I make this query in Laravel: SELECT `p`.`id`, `p`.`name`, `p`.`img`, `p`.`safe_name`, `p`.`sku`, `p`.`productstatusid` FROM `products` p WHERE `p`.`id` IN ( SELECT `product_id` FROM `product_category` WHERE `category_id` IN (\'223\', \'15\') ) AND `p`.`active`=1 I could also do this with a join, but I need this format for performance. 回答1: Consider this code: Products::whereIn('id', function($query){ $query->select('paper_type_id') ->from(with(new ProductCategory)->getTable()) -