Basically {{ $last= date('Y')-120 }} in this part you are showing the value but you need to assign the value. So assign like this :

<?php $last= date('Y')-120; ?>

Same thing goes for the for loop too.Just compare the value. Do not put it in blade syntax.

<select id="year" name="year" class="form-control ">
    {{ $last= date('Y')-120 }}
    {{ $now = date('Y') }}

    @for ($i = $now; $i >= $last; $i--)
        <option value="{{ $i }}">{{ $i }}</option>
    @endfor
</select>
Answer from Minhaj Mimo on Stack Overflow
🌐
Laravel
laravel.com › docs › 13.x › blade
Blade Templates | Laravel 13.x - The clean stack for Artisans and agents
The from method accepts the same arguments as PHP's json_encode function; however, it will ensure that the resulting JSON has been properly escaped for inclusion within HTML quotes. The from method will return a string JSON.parse JavaScript statement that will convert the given object or array into a valid JavaScript object: ... The latest versions of the Laravel application skeleton include a Js facade, which provides convenient access to this functionality within your Blade templates:
🌐
Laravel
laravel.com › learn › php-fundamentals › loops
Loops | Laravel - The clean stack for Artisans and agents
Loops are fundamental in any programming language, allowing us to repeat actions and work with collections of data. Let's explore the different types of loops in PHP and see how they're commonly used. ... Let's start with ⁠foreach, as it's the most commonly used loop in modern PHP, especially when working with arrays:
🌐
Medium
medium.com › afrivelle-engineering › using-the-loop-variable-in-laravel-9d22f07eb00b
Using the $loop variable in Laravel | by Chidozie Ogbo | Afrivelle Engineering | Medium
July 15, 2019 - “How do I know if I am on the last item in a foreach loop, so as to present the last item in a certain way?” · The answer to that would have been. Check the current index. ... Easy right? But the guys at Laravel went one step further by providing a $loop variable which can be used in this scenario.
🌐
Laravel
laravel.com › docs › 5.3 › blade
Blade Templates | Laravel 5.3 - The clean stack for Artisans and agents
Of course, if you attempt to @include a view which does not exist, Laravel will throw an error. If you would like to include a view that may or may not be present, you should use the @includeIf directive: ... You should avoid using the __DIR__ and __FILE__ constants in your Blade views, since they will refer to the location of the cached, compiled view. You may combine loops and includes into one line with Blade's @each directive: ... The first argument is the view partial to render for each element in the array or collection.
🌐
Laravel
laravel.com › docs › 13.x › eloquent-factories
Eloquent: Factories | Laravel 13.x - The clean stack for Artisans and agents
If you already have a parent model instance that should be associated with the models you are creating, you may pass the model instance to the for method: ... For convenience, you may use Laravel's magic factory relationship methods to define "belongs to" relationships.
🌐
Devsense
docs.devsense.com › vscode › frameworks › laravel
Laravel - PHP Tools - Documentation
Laravel is heavily based on service containers and dependency injection. Registered Laravel services from across the Laravel project are recognized and used for additional code completion after app() or in Laravel facades.
🌐
Laracasts
laracasts.com › discuss › channels › laravel › how-to-increment-for-loop-in-blade
How to increment for loop in blade
Would this need to be done in jquery? {{ $n = 3 }} @for ($i = 0; $i < $n; $i++) <div class="row px-3 pb-2"> <select class="form-control registerInputBoxes dropdownSelect" name="condition[{{$i}}]" id="illness[{{$i}}]" style="width: 100%;"> @foreach ($allConditions as $condition) <option value="{{ $condition->id }}">{{ $condition->condition }}</option> @endforeach </select> <div class="col-12"> <p class="registerText mb-0">Time since diagosis</p> </div> <div class="col-4"> <label for="years" class="registerText pl-2">Years</label> <input name="years" type="text" class="form-control w-25" style="
Find elsewhere
🌐
Weblate
docs.weblate.org › es › weblate-5.12.2 › formats › laravel.html
Cadenas PHP de Laravel - documentación de Weblate - 5.12.2
Formato IDML · Traducciones en INI · Traducciones INI de Inno Setup · Propiedades de Java · Traducciones para Joomla · Archivos JSON · Cadenas PHP de Laravel · Archivos Markdown · draggable/i18n lang files · Recursos Kotlin para móviles · Recursos Kotlin para móviles ·
🌐
Medium
medium.com › @itmike2018 › laravel-blade-loops-5f6029e89d10
Laravel Blade Loops | by Mike Jones | Medium
October 16, 2021 - Anyway back to the matter at hand. I want to use alternate HTML/CSS cards in my Foreach. first thing to do is checkout the incredible Docs at Laravel.
🌐
Qiita
qiita.com › laravel
Laravel:$loopによるループ変数の使用例 #フレームワーク - Qiita
November 20, 2017 - <html> <head> <title>Request&Response</title> <style> body { font-size:16pt; color:#999; } h1 { font-size:100pt; text-align: right; color:#eee; margin:-40px 0 -50px 0; } </style> </head> <body> <h1>Blade/Index</h1> <p>foreachディレクティブの例</p> @foreach($data as $item) //最初の繰り返しかどうか @if($loop->first) <p>※データ一覧</p><ul> @endif //現在の繰り返し数(1から開始) <li>NO,{{$loop->iteration}}.{{$item}}</li> //最後の繰り返しかどうか @if($loop->last) </ul><p>ここまで</p> @endif @endforeach </body> </html>
🌐
W3Schools
w3schools.com › php › php_looping_for.asp
PHP for loop
abstract and as break callable case catch class clone const continue declare default do echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile extends final finally fn for foreach function global if implements include include_once instanceof insteadof interface isset list namespace new or print private protected public require require_once return static switch throw trait try use var while xor yield yield from PHP Libxml
🌐
Laravel
laravel.com › docs › 11.x › eloquent-relationships
Eloquent: Relationships | Laravel 11.x - The clean stack for Artisans and agents
Since relationships also serve as powerful query builders, defining relationships as methods provides powerful method chaining and querying capabilities. For example, we may chain additional query constraints on this posts relationship: ... But, before diving too deep into using relationships, let's learn how to define each type of relationship supported by Eloquent.
🌐
LinkedIn
linkedin.com › pulse › laravel-loop-variable-mohammed-dayraki
The Laravel $loop Variable
October 18, 2022 - The Laravel $loop variable is a powerful variable found inside @foreach. I've been using it a lot lately as I've been working on a lot of data iterations, tables and reports.