Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix+new links #53

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions db/migrations/20241001134535_notepads_migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public function change()
$rows = $stmt->fetchAll();
foreach ($rows as $row)
{
if ($row['itemtype'] == 'Entity')
{
$row['items_id'] = $row['items_id'] + 1;
}

$data = [
[
'id' => $row['id'],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace

use Phinx\Migration\AbstractMigration;

final class TicketvalidationsUpdateMigration extends AbstractMigration
{
public function up()
{
$table = $this->table('ticketvalidations');
$table->addColumn('created_at', 'timestamp', ['null' => true, 'after' => 'id'])
->addColumn('updated_at', 'timestamp', ['null' => true, 'after' => 'created_at'])
->addColumn('deleted_at', 'timestamp', ['null' => true, 'after' => 'updated_at'])
->addColumn('is_recursive', 'boolean', ['null' => false, 'default' => false, 'after' => 'entity_id'])
->update();
}

public function down()
{
$table = $this->table('ticketvalidations');
$table->removeColumn('created_at')
->removeColumn('updated_at')
->removeColumn('deleted_at')
->removeColumn('entity_id')
->update();
}
}
21 changes: 16 additions & 5 deletions src/Models/Appliance.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Appliance extends Common
'entity',
'certificates',
'domains',
'infocom',
];

protected $visible = [
Expand All @@ -50,19 +51,20 @@ class Appliance extends Common
'tickets',
'problems',
'changes',
'infocom',
];

protected $with = [
'location:id,name',
'type:id,name',
'state:id,name',
'user:id,name',
'group:id,name',
'userstech:id,name',
'groupstech:id,name',
'user:id,name,firstname,lastname',
'group:id,name,completename',
'userstech:id,name,firstname,lastname',
'groupstech:id,name,completename',
'manufacturer:id,name',
'environment:id,name',
'entity:id,name',
'entity:id,name,completename',
'certificates:id,name',
'domains:id,name',
'knowbaseitems:id,name',
Expand All @@ -71,6 +73,7 @@ class Appliance extends Common
'tickets:id,name',
'problems:id,name',
'changes:id,name',
'infocom',
];

public function location(): BelongsTo
Expand Down Expand Up @@ -211,4 +214,12 @@ public function changes(): MorphToMany
'change_id',
);
}

public function infocom(): MorphMany
{
return $this->morphMany(
'\App\Models\Infocom',
'item',
);
}
}
2 changes: 1 addition & 1 deletion src/Models/Appliancetype.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Appliancetype extends Common
];

protected $with = [
'entity:id,name',
'entity:id,name,completename',
];

public function entity(): BelongsTo
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Budget.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Budget extends Common
protected $with = [
'location:id,name',
'type:id,name',
'entity:id,name',
'entity:id,name,completename',
'notes:id',
'knowbaseitems:id,name',
'documents:id,name',
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Businesscriticity.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ class Businesscriticity extends Common

protected $with = [
'category:id,name',
'entity:id,name',
'entity:id,name,completename',
];

public function category(): BelongsTo
{
return $this->belongsTo('\App\Models\Businesscriticity');
return $this->belongsTo('\App\Models\Businesscriticity', 'businesscriticity_id');
}

public function entity(): BelongsTo
Expand Down
19 changes: 18 additions & 1 deletion src/Models/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Models;

use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

Expand All @@ -17,18 +18,34 @@ class Calendar extends Common

protected $appends = [
'entity',
'timeranges',
'holidays',
];

protected $visible = [
'entity',
'timeranges',
'holidays',
];

protected $with = [
'entity:id,name',
'entity:id,name,completename',
'timeranges',
'holidays',
];

public function entity(): BelongsTo
{
return $this->belongsTo('\App\Models\Entity');
}

public function timeranges(): HasMany
{
return $this->hasMany('\App\Models\Calendarsegment', 'calendar_id');
}

public function holidays(): BelongsToMany
{
return $this->belongsToMany('\App\Models\Holiday', 'calendar_holiday', 'calendar_id', 'holiday_id');
}
}
33 changes: 33 additions & 0 deletions src/Models/Calendarsegment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;

class Calendarsegment extends Common
{
use SoftDeletes;

protected $definition = '\App\Models\Definitions\Calendarsegment';
protected $titles = ['Calendar segment', 'Calendar segments'];
protected $icon = 'edit';

protected $appends = [
'entity',
];

protected $visible = [
'entity',
];

protected $with = [
'entity:id,name,completename',
];

public function entity(): BelongsTo
{
return $this->belongsTo('\App\Models\Entity');
}
}
2 changes: 1 addition & 1 deletion src/Models/Cartridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Cartridge extends Common

protected $with = [
'cartridgeitems:id,name,cartridgeitemtype_id',
'printer:id,name',
'printer',
];


Expand Down
17 changes: 14 additions & 3 deletions src/Models/Cartridgeitem.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Cartridgeitem extends Common
'userstech',
'location',
'entity',
'infocom',
];

protected $visible = [
Expand All @@ -37,19 +38,21 @@ class Cartridgeitem extends Common
'documents',
'cartridges',
'printermodels',
'infocom',
];

protected $with = [
'type:id,name',
'manufacturer:id,name',
'groupstech:id,name',
'userstech:id,name',
'groupstech:id,name,completename',
'userstech:id,name,firstname,lastname',
'location:id,name',
'entity:id,name',
'entity:id,name,completename',
'notes:id',
'documents:id,name',
'cartridges:id',
'printermodels:id,name',
'infocom',
];


Expand Down Expand Up @@ -117,4 +120,12 @@ public function printermodels(): BelongsToMany
'printermodel_id'
);
}

public function infocom(): MorphMany
{
return $this->morphMany(
'\App\Models\Infocom',
'item',
);
}
}
6 changes: 3 additions & 3 deletions src/Models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ class Category extends Common

protected $with = [
'category:id,name',
'users:id,name',
'groups:id,name',
'users:id,name,firstname,lastname',
'groups:id,name,completename',
'knowbaseitemcategories:id,name',
'tickettemplatesDemand:id,name',
'tickettemplatesIncident:id,name',
'changetemplates:id,name',
'problemtemplates:id,name',
'entity:id,name',
'entity:id,name,completename',
];

public function getCompletenameAttribute()
Expand Down
21 changes: 16 additions & 5 deletions src/Models/Certificate.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Certificate extends Common
'manufacturer',
'entity',
'notes',
'infocom',
];

protected $visible = [
Expand All @@ -46,25 +47,27 @@ class Certificate extends Common
'tickets',
'problems',
'changes',
'infocom',
];

protected $with = [
'location:id,name',
'type:id,name',
'state:id,name',
'user:id,name',
'group:id,name',
'userstech:id,name',
'groupstech:id,name',
'user:id,name,firstname,lastname',
'group:id,name,completename',
'userstech:id,name,firstname,lastname',
'groupstech:id,name,completename',
'manufacturer:id,name',
'entity:id,name',
'entity:id,name,completename',
'notes:id',
'knowbaseitems:id,name',
'documents:id,name',
'contracts:id,name',
'tickets:id,name',
'problems:id,name',
'changes:id,name',
'infocom',
];

public function location(): BelongsTo
Expand Down Expand Up @@ -186,4 +189,12 @@ public function changes(): MorphToMany
'change_id',
);
}

public function infocom(): MorphMany
{
return $this->morphMany(
'\App\Models\Infocom',
'item',
);
}
}
2 changes: 1 addition & 1 deletion src/Models/Certificatetype.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Certificatetype extends Common
];

protected $with = [
'entity:id,name',
'entity:id,name,completename',
];

public function entity(): BelongsTo
Expand Down
Loading
Loading