Skip to content

Instantly share code, notes, and snippets.

@evercode1
Last active February 12, 2017 00:26
Show Gist options
  • Save evercode1/8ebd70b453ae8d38f6559c558f134e71 to your computer and use it in GitHub Desktop.
Save evercode1/8ebd70b453ae8d38f6559c558f134e71 to your computer and use it in GitHub Desktop.
Chapter 15 lesson/create.blade.php
@extends('layouts.master')
@section('title')
<title>Create a Lesson</title>
@endsection
@section('content')
<ol class='breadcrumb'>
<li><a href='/'>Home</a></li>
<li><a href='/lesson'>Lessons</a></li>
<li class='active'>Create</li>
</ol>
<h2>Create a New Lesson</h2>
<hr/>
<form class="form" role="form" method="POST" action="{{ url('/lesson') }}">
{{ csrf_field() }}
<!-- lesson name Form Input -->
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label class="control-label">Lesson Name</label>
<input type="text" class="form-control" name="name" value="{{ old('name') }}">
@if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
</div>
<!-- category select -->
<div class="form-group{{ $errors->has('category_id') ? ' has-error' : '' }}">
<label class="control-label">Category</label>
<select class="form-control" id="category_id" name="category_id">
<option value="">Please Choose One</option>
@foreach($categories as $category)
<option value="{{ $category->id }}">{{ $category->name }}</option>
@endforeach
</select>
@if ($errors->has('category_id'))
<span class="help-block">
<strong>{{ $errors->first('category_id') }}</strong>
</span>
@endif
</div>
<!-- subcategory select -->
<div class="form-group{{ $errors->has('subcategory_id') ? ' has-error' : '' }}">
<label class="control-label">Subcategory</label>
<select class="form-control" id="subcategory_id" name="subcategory_id">
<option value="">Please Choose One</option>
@foreach($subcategories as $subcategory)
<option value="{{ $subcategory->id }}">{{ $subcategory->name }}</option>
@endforeach
</select>
@if ($errors->has('subcategory_id'))
<span class="help-block">
<strong>{{ $errors->first('subcategory_id') }}</strong>
</span>
@endif
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-lg">
Create
</button>
</div>
</form>
@endsection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment