All Questions

198
votes
15answers
238753 views

How to create multiple where clause query using Laravel Eloquent?

I'm using the Laravel Eloquent query builder and I have a query where I want a WHERE clause on multiple conditions. It works, but it is not elegant. Example: $results = User:: where('this', '...
64
votes
11answers
83159 views

File permissions for Laravel 5 (and others)

I'm using Apache Web Server that has the owner set to _www:_www. I never know what is the best practice with file permissions, for example when I create new Laravel 5 project. Laravel 5 requires /sto...
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...
76
votes
7answers
104893 views

Get specific columns using "with()" function in Laravel Eloquent

I have two tables User and Post One User have many posts and one post belongs to only one user. In my User Model I have hasMany relation like public function post(){ return $this->hasman...
153
votes
19answers
232810 views

Laravel, get last insert id using Eloquent

I'm currently using this code to insert data in a table: public function saveDetailsCompany() { $post = Input::All(); $data = new Company; $data->nombre = $post['name']; $data-&g...
23
votes
1answers
40486 views

Property [title] does not exist on this collection instance

I am following Laracasts' videos: Basic Model/Controller/View Workflow. I have a table holds contact information. CREATE TABLE `about` ( `id` int(10) UNSIGNED NOT NULL, `title` varchar(500) COLLATE ...
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...
121
votes
9answers
138416 views

How to get the query executed in Laravel 5 ? DB::getQueryLog returning empty array

DB::getQueryLog returning empty array $user = User::find(5); print_r(DB::getQueryLog()); result is empty array Array ( )
52
votes
10answers
61052 views

Laravel 5 - redirect to HTTPS

Working on my first Laravel 5 project and not sure where or how to place logic to force HTTPS on my app. The clincher here is that there are many domains pointing to the app and only two out of three ...
77
votes
8answers
103714 views

Automatically deleting related rows in Laravel (Eloquent ORM)

When I delete a row using this syntax: $user->delete(); Is there a way to attach a callback of sorts, so that it would e.g. do this automatically: $this->photo()->delete(); Preferably i...

Previous Next