class="col-12 col-sm-6 col-md-3" cities и airports (обратите внимание – названия во мн. числе)id | name | другие поля, если нужноid | city_id | name | другие поля, если нужноCity и Airport (обратите внимание – названия в ед. числе)City создать отношение один-ко-многим (в городе может быть несколько аэропортов)public function airports(): \Illuminate\Database\Eloquent\Relations\HasMany {}
return $this->hasMany(\App\Models\Airport::class);
}Airport создать обратное отношениеpublic function city(): \Illuminate\Database\Eloquent\Relations\BelongsTo {}
return $this->belongsTo(\App\Models\City::class);
}$from = $request->input['otkuda'];
$city = \App\Models\City::whereName($from) // По названию города
->firstOrFail();
// или
// $fromId = $request->input['otkuda'];
// $city = \App\Models\City::findOrFail($fromId); // По ID города
dump($city->toArray()); // Получили город
dump($city->airports->toArray()); // Получили список аэропортов города$airportId = $request->input['airportId'];
$airport = \App\Models\Airport::findOrFail($airportId);
dump($airport->toArray()); // Получили аэропорт по ID
dump($airport->city->toArray()); // Получили город, в котором этот аэропорт находится. `` – шаблонная строка`${variable}` - переменная в такой строке, или любое выражение[] - массив, доступ к элементу массива по индексу или ключуid.length-1 - обычное выражение, длина массива минус одинid[id.length-1] - доступ к последнему элементу массиваlet lastIndex = id.length-1;
let lastElement = id[lastIndex];
`./articles/${lastElement}`<table border="1" width="700" height="150">
<col width="20%">
<col width="20%">
<col width="10%">
<col width="10%">
<col width="20%">
<col width="20%">
<tr>
<td colspan="6">Alan1</td>
</tr>
<tr>
<td colspan="2">Alan2</td>
<td colspan="2">Alan3</td>
<td colspan="2">Alan4</td>
</tr>
<tr>
<td rowspan="3">Alan5</td>
<td colspan="2">Alan6</td>
<td colspan="2">Alan7</td>
<td rowspan="3">Alan8</td>
</tr>
<tr>
<td>Alan9</td>
<td colspan="2" rowspan="2">Alan10</td>
<td>Alan11</td>
</tr>
<tr>
<td>Alan12</td>
<td>Alan13</td>
</tr>
</table> {{--@if (isset($citi))--}}
<table class="table-hover">
<thead>
<tr>
</tr>
</thead>
<tbody>
@if($posts->isNotEmpty())
@foreach ($posts as $post)
<div class="post-List">
<p>{{ Spost-nane }}</p>
@endForeach
@else
<div>
<h2>No posts Found</h2>
</div>
@endif
</tbody>
</table>
{{--@endif--}} :root {
--aside-width: 200px; /* По умолчанию */
}
.aside {
width: var(--aside-width);
}
.main {
margin-right: var(--aside-width);
}document.documentElement.style.setProperty('--aside-width', '200px'); // show
document.documentElement.style.setProperty('--aside-width', '0'); // hide {!! old('name', $product->description) !!}{{ old('name') ?? new HtmlString($product->description) }} "scripts": {
"post-autoload-dump": []
}"post-root-package-install": []"scripts": {
"post-autoload-dump": [
"@php -r \"copy('vendor/twbs/bootstrap/dist/boostrap.min.css', 'public/css/boostrap.min.css');\""
]
} <?php
$selected = $_POST['group'] ?? null;
?>
<select id="group" name="group" class="form-control form-control-sm">
<option value="#">Выберите группу</option>
<option value="00001" <?= $selected == '00001' ? 'selected' : '' ?> >Группа 1</option>
<option value="00002" <?= $selected == '00002' ? 'selected' : '' ?> >Группа 2</option>
<option value="00003" <?= $selected == '00003' ? 'selected' : '' ?> >Группа 3</option>
</select> // Вызываем функцию, результат кладем в переменную
const result = myFunction();// Обычное объявление
function muFuncion() { }
// Выражение с анонимной функцией
const myFunction = function() { }
// Выражение с именованной функцией
const myFunc = function myFunction() { }
// Объявление стрелочной функции
const myFunction = () => { }someFunction(function() {}) // анонимка
someFunction(() => {}) // стрелочная