laravel

Laravel 構築

専用ページを読み込み

@include('project.environments-field', [
    'title' => '渡すタイトル',
    'servers' => $servers['test'],
    'environment' => $environments['test'],
])

エラーの時、ボックスの色が変わる

<div class="form-group {{ $errors->has('department_id') ? 'has-error' : '' }}">

進んで、戻るボータンをしたら、元の値が消えないように

<select class="form-control" name="department_id" id="department_id">
    <option value="">選択してください</option>
    @foreach($departments as $department)
        <option value="{{ $department->id }}" {{ old('department_id') == $department->id ? 'selected' : '' }}>{{ $department->name }}</option>
    @endforeach
</select>

配列をviewに返す時。compact

$environments['production'] = Environment::where('name', 'production')->first();
$fileTypes = FileType::all();
        return view('admin/project/create', compact(
            'departments',
            'environments',
            'servers',
            'osUsers',
            'fileTypes'
        ));