MAIL_MAILER=smtp
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_ENCRYPTION=null
<form method="POST" if="myform">@csrf</form>
@foreach($posts as $post)
<button type="submit"
form="myform"
fromaction="{{ route('admin.post.delete', ['post' => $post->_id]) }}"
>Удалить</button>
@endforeach
env()
If you execute theconfig:cache
command during your deployment process, you should be sure that you are only calling theenv
function from within your configuration files. Once the configuration has been cached, the.env
file will not be loaded and all calls to theenv
function will returnnull
.
<input type="checkbox" name="check" value="1">
$request->validate([
'check' => 'sometimes|bool',
]);
<input type="hidden" name="check" value="0">
<input type="checkbox" name="check" value="1">
protected function prepareForValidation()
{
$this->merge([
'check' => $this->has('check')
]);
}
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()); // Получили город, в котором этот аэропорт находится.
{{--@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--}}
{!! old('name', $product->description) !!}
{{ old('name') ?? new HtmlString($product->description) }}
@if($manifestExists)
<link rel="manifest" href="{{ asset('manifests') }}/user.webmanifest">
@endif
webpack.mix.site.js
webpack.mix.dashboard.js
mix.setResourceRoot('/static/frontend');
mix.setResourceRoot('/static/dashboard');
<link href="{{ mix('css/main.css', 'static/frontend') }}" rel="stylesheet">
const mix = require('laravel-mix');
const mix2 = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js').vue()
mix2.options({
vue: { customElement: true }
})
mix2.js('resources/js/app2.js', 'public/js').vue()
use App\Http\Controllers\PageContactController;
Route::get('/contakt', [PageContactController::class, 'index']);
@foreach($weeks as $key => $value)
<input type="checkbox" value="1" name="days[{{$key}}]['d']"> {{$value}}
<input type="time" name="days[{{$key}}]['s']">
<input type="time" name="days[{{$key}}]['e']">
@endforeach
[
1 /*это $key */ => ['d' => 1, 's' => 123, 'e' => '456'],
2 /*это $key */ => [ 's' => 123, 'e' => '456'],
3 /*это $key */ => ['d' => 1, 's' => 123, 'e' => '456'],
]
use App\Http\Controllers\HomeController;
Route::get('/home', [HomeController::class, 'index']);