Skip to content

Commit

Permalink
Merge pull request #72 from peelman/AddAddressToLocation
Browse files Browse the repository at this point in the history
Add address to location form
  • Loading branch information
snipe committed Nov 27, 2013
2 parents acd9505 + 1314a1f commit e49cb9e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/controllers/admin/LocationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public function postCreate()

// Save the location data
$location->name = e(Input::get('name'));
$location->address = e(Input::get('address'));
$location->address2 = e(Input::get('address2'));
$location->city = e(Input::get('city'));
$location->state = e(Input::get('state'));
$location->country = e(Input::get('country'));
Expand Down Expand Up @@ -139,6 +141,8 @@ public function postEdit($locationId = null)

// Update the location data
$location->name = e(Input::get('name'));
$location->address = e(Input::get('address'));
$location->address2 = e(Input::get('address2'));
$location->city = e(Input::get('city'));
$location->state = e(Input::get('state'));
$location->country = e(Input::get('country'));
Expand Down
4 changes: 3 additions & 1 deletion app/models/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ class Location extends Elegant {
protected $table = 'locations';
protected $rules = array(
'name' => 'required|alpha_space|min:3',
'address' => 'required|alpha_space|min:5',
'address2' => 'alpha_space|min:5',
'city' => 'required|alpha_space|min:3',
'state' => 'required|alpha|min:2|max:2',
'country' => 'required|alpha|min:2|max:2',
'zip' => 'alpha_dash|min:5',
'zip' => 'alpha_dash|min:5',
);

public function has_users()
Expand Down
14 changes: 14 additions & 0 deletions app/views/backend/locations/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@
{{ $errors->first('name', '<span class="help-inline">:message</span>') }}
</div>
</div>
<div class="control-group {{ $errors->has('address') ? 'error' : '' }}">
<label class="control-label" for="address">Street Address 1</label>
<div class="controls">
<input class="span4" type="text" name="address" id="address" value="{{ Input::old('address', $location->address) }}" />
{{ $errors->first('address', '<span class="help-inline">:message</span>') }}
</div>
</div>
<div class="control-group {{ $errors->has('address2') ? 'error' : '' }}">
<label class="control-label" for="address2">Street Address 2</label>
<div class="controls">
<input class="span4" type="text" name="address2" id="address2" value="{{ Input::old('address2', $location->address2) }}" />
{{ $errors->first('address2', '<span class="help-inline">:message</span>') }}
</div>
</div>
<div class="control-group {{ $errors->has('city') ? 'error' : '' }}">
<label class="control-label" for="name">City</label>
<div class="controls">
Expand Down

0 comments on commit e49cb9e

Please sign in to comment.