-
-
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.
- Loading branch information
Showing
19 changed files
with
832 additions
and
89 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
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
36 changes: 36 additions & 0 deletions
36
app/database/migrations/2013_11_19_013337_create_asset_logs_table.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,36 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateAssetLogsTable extends Migration { | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('asset_logs', function($table) | ||
{ | ||
$table->increments('id'); | ||
$table->integer('user_id'); | ||
$table->string('action_type'); | ||
$table->integer('asset_id'); | ||
$table->integer('checkedout_to')->nullable; | ||
$table->integer('location_id')->nullable; | ||
$table->timestamp('added_on'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop('asset_logs'); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
app/database/migrations/2013_11_19_061409_edit_added_on_asset_logs_table.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,28 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class EditAddedOnAssetLogsTable extends Migration { | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
DB::statement('ALTER TABLE asset_logs MODIFY added_on timestamp null'); | ||
|
||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
// | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
app/database/migrations/2013_11_19_062250_edit_location_id_asset_logs_table.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,30 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class EditLocationIdAssetLogsTable extends Migration { | ||
|
||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
DB::statement('ALTER TABLE asset_logs MODIFY location_id int(11) null'); | ||
DB::statement('ALTER TABLE asset_logs MODIFY added_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'); | ||
|
||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
// | ||
} | ||
|
||
} |
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,40 @@ | ||
<?php | ||
|
||
class ActionLog extends Eloquent { | ||
|
||
protected $table = 'asset_logs'; | ||
public $timestamps = false; | ||
|
||
|
||
public function assetlog() { | ||
return $this->belongsTo('Asset','asset_id'); | ||
} | ||
|
||
public function adminlog() { | ||
return $this->belongsTo('User','user_id'); | ||
} | ||
|
||
public function userlog() { | ||
return $this->belongsTo('User','checkedout_to'); | ||
} | ||
|
||
|
||
/** | ||
* Get the parent category name | ||
*/ | ||
public function logaction($actiontype) | ||
{ | ||
$this->action_type = $actiontype; | ||
|
||
if($this->save()) | ||
{ | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
} |
Oops, something went wrong.