1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 05:14:04 +00:00

Week 17/2022

This commit is contained in:
Samuel Štancl 2022-04-29 21:07:03 +02:00
parent cb1970a9bf
commit 23979938b4
7 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,15 @@
---
title: 'You can define default model data for BelongsTo relationships'
tweet_id: '1520040284783972352'
thread_slug: weekly-thread-2022-17
author_username: cosmeescobedo
images:
- 'https://pbs.twimg.com/media/FQ6XRnBVgAAHT1w.jpg'
created_at: 2022-04-29T14:00:19+00:00
slug: you-can-define-default-model-data-for-belongsto-relationships
---
🔥 Laravel Tip: Default Models.
In your relationships, you can define default models.
That way if the relationship doesn't exist it will return a default model so you don't have to check if is null every time.