Skip to content

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…

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 anothe…

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…

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…

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 rai…