PHP Composer update “cannot allocate memory” error (using Laravel 4)

I just can’t solve this one. I’m on Linode 1G RAM basic plan. Trying to install a package via Composer and it’s not letting me. My memory limit is set to “-1” on PHP.ini Is there anything else I can do to get this installed? Loading composer repositories with package information Updating dependencies (including require-dev) … Read more

How Can I Set the Default Value of a Timestamp Column to the Current Timestamp with Laravel Migrations?

I would like to make a timestamp column with a default value of CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP using the Laravel Schema Builder/Migrations. I have gone through the Laravel documentation several times, and I don’t see how I can make that the default for a timestamp column. The timestamps() function makes the defaults 0000-00-00 00:00 for … Read more

Migration: Cannot add foreign key constraint

I’m trying to create foreign keys in Laravel however when I migrate my table using artisan i am thrown the following error: [Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL : alter table `priorities` add constraint priorities_user_id_foreign foreign key (`user_id`) references `users` (`id`)) My migration code is as so: priorities migration file … Read more

Laravel 4: how to “order by” using Eloquent ORM [duplicate]

This question already has answers here: Laravel Eloquent: Ordering results of all() (12 answers) Closed 6 years ago. Simple question – how do I order by ‘id’ descending in Laravel 4. The relevant part of my controller looks like this: $posts = $this->post->all() As I understand you use this line: ->orderBy(‘id’, ‘DESC’); But how does … Read more