35 lines
1010 B
PHP
35 lines
1010 B
PHP
<?php
|
|
|
|
namespace App\models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class ApiModel extends Model
|
|
{
|
|
|
|
function loginProductionUser($username, $password){
|
|
$i = DB::table('production_user')
|
|
->where('Username', $username)
|
|
->where('Password', $password)
|
|
->get();
|
|
return $i;
|
|
}
|
|
|
|
function getTrackingStatus($invoice)
|
|
{
|
|
$i = DB::table('tracking')->select('tracking.Id', 'tracking.InvoiceNumber', 'tracking_steps.StepLabel', 'production_user.Name', DB::raw('DATE_FORMAT(tracking.created_at, "%b %d, %Y") AS date'), DB::raw('DATE_FORMAT(tracking.created_at, "%H:%i") AS time'))
|
|
->leftjoin('tracking_steps', 'tracking_steps.Id', '=', 'tracking.StepId')
|
|
->leftjoin('production_user', 'production_user.Id', '=', 'tracking.ScannedBy')
|
|
->where('tracking.InvoiceNumber', '=', $invoice)
|
|
->orderBy('tracking.created_at', 'DESC')
|
|
->get();
|
|
return $i;
|
|
}
|
|
|
|
function insertTracking($data){
|
|
$i = DB::table('tracking')->insert($data);
|
|
return $i;
|
|
}
|
|
}
|