-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #509 - added MAC address as model option
- Loading branch information
Showing
7 changed files
with
89 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
43 changes: 43 additions & 0 deletions
43
app/database/migrations/2015_02_12_001312_add_mac_address_to_asset.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class AddMacAddressToAsset extends Migration { | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
// | ||
Schema::table('assets', function ($table) { | ||
$table->string('mac_address')->nullable()->default(NULL); | ||
}); | ||
|
||
Schema::table('models', function ($table) { | ||
$table->boolean('show_mac_address')->default(0); | ||
}); | ||
|
||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
// | ||
Schema::table('assets', function ($table) { | ||
$table->dropColumn('mac_address'); | ||
}); | ||
|
||
Schema::table('models', function ($table) { | ||
$table->dropColumn('show_mac_address'); | ||
}); | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
return array( | ||
|
||
'show_mac_address' => 'Show MAC address field in assets in this model', | ||
|
||
); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,17 @@ | |
</div> | ||
</div> | ||
|
||
@if ($asset->model->show_mac_address != 0) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
snipe
Author
Owner
|
||
<!-- MAC Address --> | ||
<div class="form-group {{ $errors->has('mac_address') ? ' has-error' : '' }}"> | ||
<label for="mac_address" class="col-md-2 control-label">@lang('admin/hardware/form.mac_address')</label> | ||
<div class="col-md-7"> | ||
<input class="form-control" type="text" name="mac_address" id="mac_address" value="{{{ Input::old('mac_address', $asset->mac_address) }}}" /> | ||
{{ $errors->first('mac_address', '<span class="alert-msg"><i class="icon-remove-sign"></i> :message</span>') }} | ||
</div> | ||
</div> | ||
@endif | ||
|
||
<!-- Purchase Date --> | ||
<div class="form-group {{ $errors->has('purchase_date') ? ' has-error' : '' }}"> | ||
<label for="purchase_date" class="col-md-2 control-label">@lang('admin/hardware/form.date')</label> | ||
|
This file contains 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
This line is blowing up on my latest pull. Throws a npe when trying to create a new asset. This logic only is valid when editing an asset associated to a model correct? Creating a new asset will not have a model and the property will be invalid which is the error I am seeing.
Based on other logic the below seems more accurate since we need to confirm whether its an existing asset or a new
@if ($asset->id)
@if ($asset->model->show_mac_address != 0)