Add initial app models. Add tinker as a dependency to allow use with artisan.

This commit is contained in:
Taylor Dondich
2019-04-25 13:47:21 -07:00
committed by Paula Quispe
parent b8fd796e25
commit 6b8065a98f
8 changed files with 416 additions and 3 deletions

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Application extends Model
{
protected $table = "APPLICATION";
}

42
app/Models/Delegation.php Normal file
View File

@@ -0,0 +1,42 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Delegation extends Model
{
protected $table = "APP_DELEGATION";
/**
* Returns the application this delegation belongs to
*/
public function application()
{
return $this->belongsTo(Application::class, 'APP_UID', 'APP_UID');
}
/**
* Returns the user this delegation belongs to
*/
public function user()
{
return $this->belongsTo(User::class, 'USR_ID', 'USR_ID');
}
/**
* Return the process task this belongs to
*/
public function task()
{
return $this->belongsTo(Task::class, 'TAS_ID', 'TAS_ID');
}
/**
* Return the process this delegation belongs to
*/
public function process()
{
return $this->belongsTo(Process::class, 'PRO_ID', 'PRO_ID');
}
}

17
app/Models/Process.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Process extends Model
{
/**
* Retrieve all applications that belong to this process
*/
public function applications()
{
return $this->hasMany(Application::class, 'PRO_ID', 'PRO_ID');
}
}

10
app/Models/Task.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Task extends Model
{
//
}

19
app/Models/User.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
protected $table = "USERS";
/**
* Returns the delegations this user has (all of them)
*/
public function delegations()
{
return $this->hasMany(Delegation::class, 'USR_ID', 'USR_ID');
}
}

View File

@@ -47,7 +47,9 @@
"ralouphie/getallheaders": "^2.0",
"smarty/smarty": "2.6.30",
"pdepend/pdepend": "@stable",
"chumper/zipper": "^1.0"
"chumper/zipper": "^1.0",
"nikic/php-parser": "3.1.5",
"laravel/tinker": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "^1.7",

315
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -22,6 +22,8 @@ return [
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Laravel\Tinker\TinkerServiceProvider::class,
],
'aliases' => [