Created
April 8, 2016 13:51
-
-
Save amatriz/83b8dc487749942dd47e41a4599b0e55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Illuminate\Database\Migrations\Migration; | |
| use Illuminate\Database\Schema\Blueprint; | |
| class CreateRepresentantesTable extends Migration | |
| { | |
| /** | |
| * Run the migrations. | |
| * | |
| * @return void | |
| */ | |
| public function up() | |
| { | |
| Schema::create('representantes', function(Blueprint $table) { | |
| $table->increments('id'); | |
| $table->string('nome'); | |
| $table->string('whatts'); | |
| $table->string('foto'); | |
| $table->string('endereco',80); | |
| $table->string('lat'); | |
| $table->string('long'); | |
| $table->integer('categoria_id')->unsigned(); | |
| $table->foreign('categoria_id')->references('id')->on('categorias')->onDelete('cascade'); | |
| $table->timestamps(); | |
| }); | |
| } | |
| /** | |
| * Reverse the migrations. | |
| * | |
| * @return void | |
| */ | |
| public function down() | |
| { | |
| Schema::drop('representantes'); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @extends('layouts.master') | |
| @section('content') | |
| <h1>Create New Representante</h1> | |
| <hr/> | |
| {!! Form::open(['url' => 'representante', 'class' => 'form-horizontal']) !!} | |
| <div class="form-group {{ $errors->has('title') ? 'has-error' : ''}}"> | |
| {!! Form::label('nome', 'Nome: ', ['class' => 'col-sm-3 control-label']) !!} | |
| <div class="col-sm-6"> | |
| {!! Form::text('nome', null, ['class' => 'form-control']) !!} | |
| {!! $errors->first('nome', '<p class="help-block">:message</p>') !!} | |
| </div> | |
| </div> | |
| <div class="form-group {{ $errors->has('whatts') ? 'has-error' : ''}}"> | |
| {!! Form::label('whatts', 'Whatts: ', ['class' => 'col-sm-3 control-label']) !!} | |
| <div class="col-sm-6"> | |
| {!! Form::text('whatts', null, ['class' => 'form-control']) !!} | |
| {!! $errors->first('whatts', '<p class="help-block">:message</p>') !!} | |
| </div> | |
| </div> | |
| <div class="form-group {{ $errors->has('foto') ? 'has-error' : ''}}"> | |
| {!! Form::label('foto', 'Foto: ', ['class' => 'col-sm-3 control-label']) !!} | |
| <div class="col-sm-6"> | |
| {!! Form::file('foto', null, ['class' => 'form-control']) !!} | |
| {!! $errors->first('foto', '<p class="help-block">:message</p>') !!} | |
| </div> | |
| </div> | |
| <div class="form-group {{ $errors->has('endereco') ? 'has-error' : ''}}"> | |
| {!! Form::label('endereco', 'Endereço: ', ['class' => 'col-sm-3 control-label']) !!} | |
| <div class="col-sm-6"> | |
| {!! Form::text('endereco', null, ['class' => 'form-control']) !!} | |
| {!! $errors->first('endereco', '<p class="help-block">:message</p>') !!} | |
| </div> | |
| </div> | |
| <div class="form-group {{ $errors->has('lat') ? 'has-error' : ''}}"> | |
| {!! Form::label('lat', 'Latitude: ', ['class' => 'col-sm-3 control-label']) !!} | |
| <div class="col-sm-6"> | |
| {!! Form::text('lat', null, ['class' => 'form-control']) !!} | |
| {!! $errors->first('lat', '<p class="help-block">:message</p>') !!} | |
| </div> | |
| </div> | |
| <div class="form-group {{ $errors->has('long') ? 'has-error' : ''}}"> | |
| {!! Form::label('long', 'Longitude: ', ['class' => 'col-sm-3 control-label']) !!} | |
| <div class="col-sm-6"> | |
| {!! Form::text('long', null, ['class' => 'form-control']) !!} | |
| {!! $errors->first('long', '<p class="help-block">:message</p>') !!} | |
| </div> | |
| </div> | |
| <div class="form-group {{ $errors->has('categoria_id') ? 'has-error' : ''}}"> | |
| {!! Form::label('categoria_id', 'Categoria: ', ['class' => 'col-sm-3 control-label']) !!} | |
| <div class="col-sm-6"> | |
| {!! Form::text('categoria_id', null, ['class' => 'form-control']) !!} | |
| {!! $errors->first('categoria_id', '<p class="help-block">:message</p>') !!} | |
| </div> | |
| </div> | |
| <div class="form-group"> | |
| <div class="col-sm-offset-3 col-sm-3"> | |
| {!! Form::submit('Create', ['class' => 'btn btn-primary form-control']) !!} | |
| </div> | |
| </div> | |
| {!! Form::close() !!} | |
| @if ($errors->any()) | |
| <ul class="alert alert-danger"> | |
| @foreach ($errors->all() as $error) | |
| <li>{{ $error }}</li> | |
| @endforeach | |
| </ul> | |
| @endif | |
| @endsection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment