Add new models and page for motions

This commit is contained in:
2025-12-27 16:51:57 +01:00
parent 3ef975ad39
commit 45fe15eef2
36 changed files with 3753 additions and 355 deletions

20
app/Models/Anforande.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Anforande extends Model
{
protected $table = 'anforande';
public $timestamps = false;
public function dokument()
{
return $this->belongsTo(Dokument::class, 'dok_hangar_id', 'hangar_id');
}
public function person()
{
return $this->belongsTo(Person::class, 'intressent_id', 'intressent_id');
}
}

20
app/Models/Debatt.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Debatt extends Model
{
protected $table = 'debatt';
public $timestamps = false;
public function dokument()
{
return $this->belongsTo(Dokument::class, 'hangar_id', 'hangar_id');
}
public function person()
{
return $this->belongsTo(Person::class, 'intressent_id', 'intressent_id');
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DokAktivitet extends Model
{
protected $table = 'dokaktivitet';
public $timestamps = false;
protected $fillable = [
'hangar_id',
'kod',
'datum',
'namn',
'status',
'ordning',
'process',
];
public function dokument()
{
return $this->belongsTo(Dokument::class, 'hangar_id', 'hangar_id');
}
}

28
app/Models/DokBilaga.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DokBilaga extends Model
{
protected $table = 'dokbilaga';
public $timestamps = false;
protected $fillable = [
'hangar_id',
'dok_id',
'filnamn',
'titel',
'subtitel',
'filstorlek',
'filtyp',
'fil_url',
];
public function dokument()
{
return $this->belongsTo(Dokument::class, 'hangar_id', 'hangar_id');
}
}

34
app/Models/DokForslag.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DokForslag extends Model
{
protected $table = 'dokforslag';
public $timestamps = false;
protected $fillable = [
'hangar_id',
'nummer',
'beteckning',
'lydelse',
'lydelse2',
'utskottet',
'kammaren',
'behandlas_i',
'behandlas_i_punkt',
'kammarbeslutstyp',
'intressent',
'avsnitt',
'grundforfattning',
'andringsforfattning',
];
public function dokument()
{
return $this->belongsTo(Dokument::class, 'hangar_id', 'hangar_id');
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DokIntressent extends Model
{
protected $table = 'dokintressent';
public $timestamps = false;
protected $fillable = [
'hangar_id',
'intressent_id',
'namn',
'partibet',
'ordning',
'roll',
];
public function dokument()
{
return $this->belongsTo(Dokument::class, 'hangar_id', 'hangar_id');
}
public function person()
{
return $this->belongsTo(Person::class, 'intressent_id', 'intressent_id');
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DokMotforslag extends Model
{
protected $table = 'dokmotforslag';
public $timestamps = false;
public function dokument()
{
return $this->belongsTo(Dokument::class, 'hangar_id', 'hangar_id');
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DokReferens extends Model
{
protected $table = 'dokreferens';
public $timestamps = false;
protected $fillable = [
'hangar_id',
'referenstyp',
'ref_dok_id',
'uppgift',
'ref_dok_typ',
'ref_dok_rm',
'ref_dok_bet',
'ref_dok_titel',
'ref_dok_subtitel',
'ref_dok_subtyp',
'ref_dok_dokumentnamn',
];
public function dokument()
{
return $this->belongsTo(Dokument::class, 'hangar_id', 'hangar_id');
}
}

30
app/Models/DokUppgift.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DokUppgift extends Model
{
protected $table = 'dokuppgift';
public $timestamps = false;
protected $fillable = [
'hangar_id',
'kod',
'namn',
'text',
'dok_id',
'systemdatum',
];
protected $casts = [
'systemdatum' => 'datetime',
];
public function dokument()
{
return $this->belongsTo(Dokument::class, 'hangar_id', 'hangar_id');
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DokUtskottsforslag extends Model
{
protected $table = 'dokutskottsforslag';
public $timestamps = false;
public function dokument()
{
return $this->belongsTo(Dokument::class, 'hangar_id', 'hangar_id');
}
}

102
app/Models/Dokument.php Normal file
View File

@@ -0,0 +1,102 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Dokument extends Model
{
protected $table = 'dokument';
protected $primaryKey = 'hangar_id';
public $timestamps = false;
protected $fillable = [
'hangar_id',
'dok_id',
'rm',
'beteckning',
'typ',
'subtyp',
'doktyp',
'typrubrik',
'dokumentnamn',
'debattnamn',
'tempbeteckning',
'organ',
'mottagare',
'nummer',
'slutnummer',
'datum',
'systemdatum',
'publicerad',
'titel',
'subtitel',
'status',
'htmlformat',
'relaterat_id',
'source',
'sourceid',
'dokument_url_text',
'dokument_url_html',
'dokumentstatus_url_xml',
'utskottsforslag_url_xml',
'html',
];
public function utskottsforslag()
{
return $this->hasMany(DokUtskottsforslag::class, 'hangar_id', 'hangar_id');
}
public function motforslag()
{
return $this->hasMany(DokMotforslag::class, 'hangar_id', 'hangar_id');
}
public function aktiviteter()
{
return $this->hasMany(DokAktivitet::class, 'hangar_id', 'hangar_id');
}
public function intressenter()
{
return $this->hasMany(DokIntressent::class, 'hangar_id', 'hangar_id');
}
public function forslag()
{
return $this->hasMany(DokForslag::class, 'hangar_id', 'hangar_id');
}
public function uppgifter()
{
return $this->hasMany(DokUppgift::class, 'hangar_id', 'hangar_id');
}
public function bilagor()
{
return $this->hasMany(DokBilaga::class, 'hangar_id', 'hangar_id');
}
public function referenser()
{
return $this->hasMany(DokReferens::class, 'hangar_id', 'hangar_id');
}
public function debatter()
{
return $this->hasMany(Debatt::class, 'hangar_id', 'hangar_id');
}
public function voteringar()
{
return $this->hasMany(Votering::class, 'hangar_id', 'hangar_id');
}
public function anforanden()
{
return $this->hasMany(Anforande::class, 'dok_hangar_id', 'hangar_id');
}
}

31
app/Models/Organ.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Organ extends Model
{
protected $table = 'organ';
protected $primaryKey = 'id';
public $timestamps = false;
protected $fillable = [
'id',
'kod',
'namn',
'typ',
'status',
'sortering',
'namn_en',
'domän',
'beskrivning',
];
public function personUppdrag()
{
return $this->hasMany(PersonUppdrag::class, 'organ_kod', 'kod');
}
}

61
app/Models/Person.php Normal file
View File

@@ -0,0 +1,61 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Person extends Model
{
protected $table = 'person';
protected $primaryKey = 'intressent_id';
protected $keyType = 'string';
public $incrementing = false;
public $timestamps = false;
protected $fillable = [
'intressent_id',
'född_år',
'kön',
'efternamn',
'tilltalsnamn',
'sorteringsnamn',
'iort',
'parti',
'valkrets',
'status',
];
public function uppdrag()
{
return $this->hasMany(PersonUppdrag::class, 'intressent_id', 'intressent_id');
}
public function uppgifter()
{
return $this->hasMany(PersonUppgift::class, 'intressent_id', 'intressent_id');
}
public function voteringar()
{
return $this->hasMany(Votering::class, 'intressent_id', 'intressent_id');
}
public function anforanden()
{
return $this->hasMany(Anforande::class, 'intressent_id', 'intressent_id');
}
public function debatter()
{
return $this->hasMany(Debatt::class, 'intressent_id', 'intressent_id');
}
public function dokIntressenter()
{
return $this->hasMany(DokIntressent::class, 'intressent_id', 'intressent_id');
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PersonUppdrag extends Model
{
protected $table = 'personuppdrag';
public $timestamps = false;
protected $fillable = [
'intressent_id',
'organ_kod',
'roll_kod',
'ordningsnummer',
'status',
'typ',
'from',
'tom',
'uppgift',
];
protected $casts = [
'from' => 'datetime',
'tom' => 'datetime',
];
public function person()
{
return $this->belongsTo(Person::class, 'intressent_id', 'intressent_id');
}
public function organ()
{
return $this->belongsTo(Organ::class, 'organ_kod', 'kod');
}
public function roll()
{
return $this->belongsTo(Roll::class, 'roll_kod', 'kod');
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PersonUppgift extends Model
{
protected $table = 'personuppgift';
public $timestamps = false;
protected $fillable = [
'intressent_id',
'uppgift_kod',
'uppgift',
'uppgift_typ',
];
public function person()
{
return $this->belongsTo(Person::class, 'intressent_id', 'intressent_id');
}
}

31
app/Models/Planering.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Planering extends Model
{
protected $table = 'planering';
protected $primaryKey = 'nyckel';
public $timestamps = false;
protected $casts = [
'datum' => 'datetime',
'publicerad' => 'datetime',
'uppdaterad' => 'datetime',
'wn_expires' => 'datetime',
'timestamp' => 'datetime',
'slutdatum' => 'datetime',
'webbtvlive' => 'boolean',
];
public function person()
{
return $this->belongsTo(Person::class, 'intressent_id', 'intressent_id');
}
public function mottagare()
{
return $this->belongsTo(Person::class, 'mottagare_id', 'intressent_id');
}
}

16
app/Models/Riksmote.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Riksmote extends Model
{
protected $table = 'riksmote';
protected $primaryKey = 'pk';
public $timestamps = false;
protected $casts = [
'start' => 'datetime',
'slut' => 'datetime',
];
}

16
app/Models/Roll.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Roll extends Model
{
protected $table = 'roll';
protected $primaryKey = 'pk';
public $timestamps = false;
public function personUppdrag()
{
return $this->hasMany(PersonUppdrag::class, 'roll_kod', 'kod');
}
}

20
app/Models/Votering.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Votering extends Model
{
protected $table = 'votering';
public $timestamps = false;
public function dokument()
{
return $this->belongsTo(Dokument::class, 'hangar_id', 'hangar_id');
}
public function person()
{
return $this->belongsTo(Person::class, 'intressent_id', 'intressent_id');
}
}