Laravel Tip - Use @forelse Instead Of @foreach Inside Laravel Blade

  Рет қаралды 3,731

Laratips

Laratips

Күн бұрын

In this video, we will look at using forelse instead of foreach in Laravel Blade. It will force us to write what happens when there is no data available which otherwise we may miss.
Social Media Links:
Let's be friends
/ aashish_dhamala
Follow On Facebook
/ laratipsofficial
Follow On Twitter
/ laratips1
Tech stack:
Laravel
PHP
#laravel #php #laraveltip #laratips

Пікірлер: 10
@dariusdxd
@dariusdxd 3 жыл бұрын
Very good tutorial! Thanks!
@koxjnk
@koxjnk Жыл бұрын
Thank you, sir, I have a problem. When I put foreach or forelse, show up the duplicated data. How to solve this? thanks
@joyustcian222
@joyustcian222 3 жыл бұрын
very informative
@dibbyo456
@dibbyo456 3 жыл бұрын
Awesome.
@sangamsingh6866
@sangamsingh6866 3 жыл бұрын
OSM
@aymanesadki1716
@aymanesadki1716 3 жыл бұрын
hey i have a problem i need ur help when i wright @foreach in visual studio, he dnot recognized @foreach its like im writing normal text what should i do ?
@Laratips
@Laratips 3 жыл бұрын
You can install "Laravel Blade Snippets" package and may be your issue will be resolved
@aymanesadki1716
@aymanesadki1716 3 жыл бұрын
@@Laratips ok i will try that because what im trying to do is import data from sql server in my blade.php page this is how it look : @foreach($listado as $1) {{$1->id_v}} {{$1->username}} {{11->mdp}} @endforeach i try to fixed by writing !! in the tags of data name colon {!!$1->id_v!!} {!!$1->username!!} {!!11->mdp!!} but he give me this error : syntax error, unexpected token "foreach"
@Laratips
@Laratips 3 жыл бұрын
You are writing $1 as variable name which is not supported in php. And also in one line you are doing 11->mdp. After you fix this, it should work
@aymanesadki1716
@aymanesadki1716 3 жыл бұрын
@@Laratips yes it's working thanks u 😊
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 22 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 33 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 27 МЛН
9 Tips for Shorter Laravel Code
10:16
Laravel Daily
Рет қаралды 62 М.
Eloquent or Query Builder: When to Use Which?
5:48
Laravel Daily
Рет қаралды 89 М.
Gemini 2.0 for developers
6:59
Google for Developers
Рет қаралды 43 М.
Laravel Security: Top 7 Mistakes Developers Make
11:16
Laravel Daily
Рет қаралды 87 М.
HAKUNA MATATA | MR MACARONI | QUEEN DOLLAR | MZ ENE | BRO BOUCHE
5:08
INDIA 🇮🇳 to AFGHANISTAN  Toughest CYCLE Ride
27:49
Cycle Baba
Рет қаралды 173 М.
Laravel Advanced - Task Scheduling - CRON Job
16:26
Laratips
Рет қаралды 63 М.
9 Quick Tips about Laravel Blade
7:38
Laravel Daily
Рет қаралды 17 М.
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 22 МЛН