Order table using another table

Hi. I have two tables: Threads: -id -name Posts: -id -content -thread_id I want sort threads by posts quantity...
00

Improving Query

$data = TopWireless::select(DB::raw('UserName, sum(AcctInputOctets) as Input , sum(AcctOutputOctets) as Output')) ->...
03

Eager loading relationship returning entire table

I have a simple database with the following tables: stories, authors, comments and users...
02

Problems with search Form

Hello Community, I created a really nice Application with the help of Laravel, but there are a few things that I couldn't solve. I hope you...
03

Group by 2 columns and show latest for each group

I'm trying to group by 2 columns and show the latest entry for each group, but can't get it working. Does anyone know how to do this? Produc...
05

Model boot event

I have a boot function in two different models like below. // create records via $model->create($request);...
03

Relationship count

Hey guys, I have done some research on the forum/google and could not find the answer to this problem. I will try to explain the problem and what I...
01

Tags relation with 2 tables only

I have a model "People" and one more model "PeopleTag". Example records: People: #1 George #2 Lara #3 John People...
00

N days Difference in two date fields

Hi guys, Need help in Eloquent Query. Have two Date fields: delivery_date - format('Y-m-d') cr...
04

return JSON from multi level DB

Hello All, I am trying to do the following with the JSON return: [ { "Stream":{ "id"...
01

BelongsToMany optimizing with currently loggedin User

Hi, currently this is my code: class Sheep extends Models { protected $appends = ['herd']; public function getHerdAttribute(...
02

Make eloquent model for subtype.

I'm creating a school platform where students, teachers,... can login using their credentials. To reduce duplicate data I did not make a separate t...
08

Eloquent custom pivot table not returning custom columns

I have models School, Sport and a custom pivot called SchoolSport which has school_id, sport_id, id and body fields. Here's the School's spo...
01

hasOne relationships - trying to get property of non object

Hi just wondering if anyone can pass on a bit of advice for this. I have a model (Customer) that has a hasOne relationship to another (Curre...
03

Requesting advice on relationships

I am creating a complex website and im planning relationships right now and would like a second opinion on it or suggestions how to keep it from go...
02

Requesting data: Proxy for take data from database or webservice

Hi there, currently I'm in process planning a refactoring of a existing software. This software get a bulk of data over a webservice connect...
04

How do you make Model database for a home page that has different content?

For example: section 1 has two picture section 2 has text and one image section 3 has a slide with multiple image secti...
00

Check relationship has a relationship

Hi All, I am trying to check inside the model whether a belongsTo relationship has an associated relationship. // Task Model...
02

Why the attach method returns null when successfully inserted?

There is another way to check whether the record was successfully inserted? if(is_null(Webstore::find(1)->ch...
06

protected $connection in Model is not being recognized

Disregard this. I recreated my app from scratch just to test the setup and it worked just fine. I must've boogered it up somewhere. I am try...
00