added api for tracking
This commit is contained in:
34
app/Models/ApiModel.php
Normal file
34
app/Models/ApiModel.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use DB;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MainModel extends Model {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user