Rename Table

I am using; "php artisan make:model user -m" command to create user table. But Laravel always makes plural table name. For example...
02

Change Date Format using Mutator

namespace App; use Carbon\Carbon; use Illuminate\Database\Eloquent\Model; class UserInformation extends Model { /** * The tabl...
21

Update a JSON key stored in a JSON type field

In my application I have added functionality to let users add their own fields, and I´m storing this fields in a JSON column in MySQL. I would lik...
05

Why does WhereHas with Where break the query?

This returns 3 order results, one of which has an id of 12: $order = Order::completed() ->whereHas('orderPayments', f...
03

How to perform sql query with Eloquent?

Hi, guys! I have a table which consist GEOMETRY information (some polygons for map). I need to perform some queries to this table: SET...
02

How to manage Enum in Laravel

Hello Everyone, I am in serious need of expert advice here, please. Consider scenario i have profiles table for users. In profiles ta...
04

How to count hasMany relationship

Hi! I'm new at Laravel and I'm loving it! I have Users and Groups table which has one to many and many to one relationship eloquently set up...
01

Create complex query with Eloquent

Suppose, App\Post model has an attribute title. Now for a given array $words I want to get those posts of wh...
01

Relationship by type?

I have a collection of options, each with a name, description & type. The type field is populated with other model names, eg. App\Customer. The...
03

Query with to Eloquent

Hello guys, Im still new with all this Laravel/ eloquent stuff Could you help me do the eloquent version of this next query?...
09

Query by pivot relationship value

I have Inquiry which is in many-to-many relationship with Services. Relation is stored in pivot table: inquiry_service. Inquiry Mode...
12

Query whereBetween [100, 1] does not work

Hi Guys, I was writing a custom sorting system with sortable. I had to get all sortables between two objects that have been swapped a...
05

What real life problem does 'migrations' feature of Laravel solve?

Note: I've picked up 'Eloquent' channel for this discussion, but I'm not sure if this belongs here. Migrations facility seems to be quite aw...
02

addGlobalScope trait

Hi. I want to refactor my codes a little more and decided to move the boot method into a trait: trait AddsGlobalScope {...
02

Laravel 5.4 with Moloquent give error when insert data

I have this error with moloquent/moloquent package. composer require moloquent/moloquent My Item...
00

Custom Key Name with field from different table

I have two database tables that I want to use in my model with the main one being a subset of authors, those with published books. The model should...
07

showing the extract of an account

Hi. I'm working on our own accounting system which includes cash, bank account, inventory etc. I have the tables for all these processes. Now i wan...
10

Working with HEX values.

I have been beating my head against a wall trying to get a seemingly simple relationship to work with no luck. I then tried a few simpler queries...
04

Property [***] does not exist on this collection instance.

I tried doing this for a website but my 'hotel' table has both an 'id' and a 'hotel_id' column. How would I define my relationship with the comment...
04

List channels and a boolean field that determines existence of a pivot table relation

I have a table "channels" and a pivot table "channel_user". When listing channels on the page, I want to show a "su...
02