Support the ongoing development of Laravel.io →

988 Threads

How to check if a Foreign Key exists

In my migration code I have: if (Schema::hasTable('activity_log')) { Schema::table('activity...

0 Likes
8 Replies
Solved

DB::select with raw where

Hey, I'm having a hard time compiling the DB:: or preferably Eloquent code for a query that involves...

0 Likes
6 Replies
Solved
posted 10 years ago

Eloquent get count relation

My Eloquent model Module has many Sections. I can query thus: Module::with('sections')->get();...

0 Likes
9 Replies
Solved
posted 9 years ago

Sort by distant relationship

Hello. So I have these Models: Product - for example, a t-shirt ProductVariant - for example, a XL-s...

0 Likes
4 Replies
Solved

Querying a model using conditions in relationship

Hello I'm making a webapp with categories, pages and banners that can be displayed on pages based on...

0 Likes
2 Replies
Solved

Eloquent model hinting in PhpStorm works within php block but not in blade

Hi, I'm using PhpStorm 2016.3.3 version and in my dashboard.blade.php file, I have the following cod...

0 Likes
4 Replies
Solved

Using Illuminate/database outside of framework

I am trying to use the package with my CodeIgniter project by following the instructions given in re...

0 Likes
2 Replies
Solved

Is there any benefit to specifying a class instead of a string in a model's relations?

Is there any benefit to the following 2 pieces of code in a model class? Which one should I adopt an...

0 Likes
2 Replies
Solved

Laravel Query Builder Issue with get()

I'm following the Laravel from Scratch series from laracasts and am trying to build my own website....

0 Likes
1 Replies
Solved
posted 6 years ago

laravel join query where AND OR both cluse

how to write Laravel 5.4 Eloquent for the query like this, where ( (table1.fname like %xxxxx% ) OR (...

0 Likes
9 Replies
Solved

what should contain in pivot table

I'm trying to use pivot table. But I'm confused how should I define my database tables. Concept: Pac...

0 Likes
1 Replies
Solved

opposite eloquent method to grabbing related data

I am looking for the opposite of getting all Data that is related in a many to many relations, thus...

0 Likes
5 Replies
Solved

save() function doesn't work and does not output an error

Hello, I am experiencing a strange problem with the built-in User class in Laravel. Its save() funct...

0 Likes
10 Replies
Solved

How do you save image to database and display it on website?

I was always against this approach, but now I am reconsidering. Is there a best practice way to do t...

0 Likes
31 Replies
Solved

Nested relation doesn't work

Hi, I'm new in laravel, and I encounter problem when get relation data through 3 tables.. I had seve...

0 Likes
4 Replies
Solved

Eloquent between two dates from database

i am trying to get an object from a database where the schema is timestamp period_starts_at timestam...

0 Likes
7 Replies
Solved

How to update database table when change the Migration ?

If I change the Migration Structure (such like CreatePasswordResetsTable) How I to change the databa...

0 Likes
5 Replies
Solved

QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'where clause'

Illuminate \ Database \ QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' i...

0 Likes
2 Replies
Solved
posted 7 years ago

eager loading question / issue ?

I've got this : $location = \App\Location::find($location_id)->with('items','items.vendor...

0 Likes
1 Replies
Solved
posted 10 years ago

Model Update Method

I want to know if I can use this: User::update($id,array( 'username '=>Input::get('username'...

0 Likes
4 Replies
Solved

Thanks to our community

Solutions given in the past year. Excluding solutions from thread authors.

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.