M3 Integration fixes
This commit is contained in:
Executable
Executable
+29
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\M3\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ICM428M extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $connection = 'pgsql';
|
||||
|
||||
protected $table;
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'ICM428M';
|
||||
}
|
||||
|
||||
// R428DV R428PL R428WHS R428STS R428US R428FIRST R428FAMILY R428EMPCDE R428ADMUSR R428PWRUSR -->
|
||||
protected $fillable = [
|
||||
'R428CO', 'R428PL', 'R428WH', 'R428STS', 'R428US', 'R428FIRST', 'R428FAMILY', 'R428EMPCDE', 'R428ADMUSR', 'R428PWRUSR',
|
||||
];
|
||||
}
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\M3\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ICM658M extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $connection = 'pgsql';
|
||||
|
||||
protected $table;
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'ICM658M';
|
||||
}
|
||||
|
||||
protected $fillable = [
|
||||
'R658CO', 'R658PL', 'R658WH', 'R658LC', 'R658PN', 'R658MQ', 'R658RQ', 'R658TL', 'R658RMQ', 'R658IZLCF',
|
||||
];
|
||||
}
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\M3\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ShipTo extends Model
|
||||
{
|
||||
protected $table = 'ICM665M';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $primaryKey = ['AUSHSHZP', 'AUSHWHS'];
|
||||
|
||||
protected $uniqueKey = ['AUSHSHZP', 'AUSHWHS'];
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
'AUSTCN',
|
||||
'AUSHSHNM',
|
||||
'AUSHSHA1',
|
||||
'AUSHSHA2',
|
||||
'AUSHSHCI',
|
||||
'AUSHSHST',
|
||||
'AUSHSHZP',
|
||||
'AUSHSHCT',
|
||||
'AUSHWHS',
|
||||
];
|
||||
|
||||
public function save(array $options = [])
|
||||
{
|
||||
if ($this->validateUniqueComposite()) {
|
||||
return parent::save($options);
|
||||
} else {
|
||||
return false;
|
||||
// ->withErrors(['unique' => 'The combination of AUSHSHZP and AUSHWHS must be unique'])
|
||||
// ->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
protected function validateUniqueComposite()
|
||||
{
|
||||
$query = self::query();
|
||||
|
||||
// Check if the combination of AUSHSHZP and AUSHWHS already exists
|
||||
$existingRecord = $query->where('AUSHSHZP', $this->AUSHSHZP)
|
||||
->where('AUSHWHS', $this->AUSHWHS);
|
||||
|
||||
// If this is an existing record being updated, exclude itself from the check
|
||||
if ($this->exists) {
|
||||
$existingRecord->where($this->getKeyName(), '!=', $this->getKey());
|
||||
}
|
||||
|
||||
if ($existingRecord->count() > 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\M3\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user