All Questions

326
votes
20answers
206495 views

Laravel requires the Mcrypt PHP extension

I am trying to use the migrate function in Laravel 4 on OSX. However, I am getting the following error: Laravel requires the Mcrypt PHP extension. As far as I understand, it's already enabled (see ...
164
votes
24answers
250689 views

PDOException SQLSTATE[HY000] [2002] No such file or directory

I believe that I've successfully deployed my (very basic) site to fortrabbit, but as soon as I connect to SSH to run some commands (such as php artisan migrate or php artisan db:seed) I get an error m...
54
votes
14answers
119366 views

How can I remove "public/index.php" in the url generated laravel?

Basically I need to remove index.php or public/index.php from the the generated URL in laravel, commonly path is localhost/public/index.php/someWordForRoute, It should be something like localhost/so...
123
votes
17answers
74628 views

Laravel redirect back to original destination after login

This seems like a pretty basic flow, and Laravel has so many nice solutions for basic things, I feel like I'm missing something. A user clicks a link that requires authentication. Laravel's auth fil...
60
votes
9answers
49771 views

How to install Laravel 4 to a web host subfolder without publicly exposing /app/ folder?

I was wondering if any of you know of a way to install Laravel 4 in a web host SUBDIRECTORY / subfolder while not exposing the /app/ folder and other sensible files to the publicly accesible part of t...
257
votes
19answers
268400 views

How do I get the query builder to output its raw SQL query as a string?

Given the following code: DB::table('users')->get(); I want to get the raw SQL query string that the query builder above will generate, so in this example it would be SELECT * FROM users. How d...
43
votes
6answers
58184 views

How to select from subquery using Laravel Query Builder?

I'd like to get value by the following SQL using Eloquent ORM. - SQL SELECT COUNT(*) FROM (SELECT * FROM abc GROUP BY col1) AS a; Then I considered the following. - Code $sql = Abc::from('ab...
34
votes
5answers
20863 views

Authentication with 2 different tables

I need to create a new "auth" config with another table and users. I have one table for the "admin" users and another table for the normal users. But how can I create another instance of Auth with a ...
151
votes
24answers
169069 views

Laravel's Blade: how can I set variables in a template?

I'm reading Laravel Blade's templating docs and I can't find how I can assign variables inside a template for use later in the template. I can't do {{ $old_section = "whatever" }} because that will ec...
77
votes
5answers
58571 views

Laravel check if related model exists

I have an Eloquent model which has a related model: public function option() { return $this->hasOne('RepairOption', 'repair_item_id'); } public function setOptionArrayAttribute($values) { ...

Previous Next