Skip to content
Advertisement

Tag: laravel

Safely remove migration In Laravel

In Laravel, there appears to be a command for creating a migration, but not removing. Create migration command: If I want to delete the migration, can I just safely delete the corresponding migrations file within the database/migrations folder? Migrations file: Answer I accidentally created a migration with a bad name (command: php artisan migrate:make). I did not run (php artisan

Laravel Add a new column to existing table in a migration

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… In terminal, I execute php artisan migrate:install and migrate. How do I add new columns? Answer To create a migration, you may use the migrate:make command on the Artisan CLI. Use a specific

How to echo to console in Laravel and Artisan?

I was curious, I’m using Laravel and Artisan for my migrations. Is there a method to output information to the console? I can’t seem to find any information on this. For example: Answer Don’t know if you are using Laravel 3 or Laravel 4, and if its also possible in Laravel 3, but i found this in the docs. EDIT

manipulate a result set from laravel eloquent

I’ve just picked up laravel after deciding to move to a php framework. I’m retrieving a result set of articles from a database using an eloquent query: this works fine and results come out as expected. However I now want to change the format of the article date from the mysql date format to another for the entire collection. I

Laravel 4 always returns HTTP status code 200

I have below code in error.php, which is triggered using App::abort(404, $error) in my controller. Still my response status code is 200(ok). I tried with various error codes like 400, 403 Answer For anyone still googling this problem: I was struggling with this problem for hours. For me the problem was caused by an issue with one of my controllers.

Why don’t large files download easily in Laravel?

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 Anything I am doing wrong? — Edit

Summing over multiple fields in Laravel

I’m wondering if it is possible to take the sum of multiple fields in one query using the fluent query builder. I currently have two tables: events and attendees. Attendees belong to events and have two fields: total_raised and total_hours. What I want to do is select all events and the total amount raised/total number of hours spent on that

Advertisement