diff --git a/app/Http/Controllers/MarhunController.php b/app/Http/Controllers/MarhunController.php index 779cd88..a42c8e8 100644 --- a/app/Http/Controllers/MarhunController.php +++ b/app/Http/Controllers/MarhunController.php @@ -51,7 +51,7 @@ class MarhunController extends Controller } public function getAllJemas(){ - $jemas = Jemas::on('mysql7')->get(); + $jemas = Jemas::on('mysql7')->orderBy('ordernum', 'asc')->get(); return response()->json($jemas); } diff --git a/app/Jemas.php b/app/Jemas.php index e6579e8..297918a 100644 --- a/app/Jemas.php +++ b/app/Jemas.php @@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model; class Jemas extends Model { protected $table = 'jemas'; + public $timestamps = false; /** * The attributes that are mass assignable. diff --git a/database/seeds/SortJenisEmas.php b/database/seeds/SortJenisEmas.php new file mode 100644 index 0000000..9e8c6c9 --- /dev/null +++ b/database/seeds/SortJenisEmas.php @@ -0,0 +1,72 @@ +where('marhun', '=', 'G/T')->update([ + 'ordernum' => '1', + ]); + + Jemas::on('mysql7')->where('marhun', '=', 'CIN')->update([ + 'ordernum' => '2', + ]); + + Jemas::on('mysql7')->where('marhun', '=', 'R/K')->update([ + 'ordernum' => '3', + ]); + + Jemas::on('mysql7')->where('marhun', '=', 'SBG')->update([ + 'ordernum' => '4', + ]); + + Jemas::on('mysql7')->where('marhun', '=', 'L/L')->update([ + 'ordernum' => '5', + ]); + + Jemas::on('mysql7')->where('marhun', '=', 'LKT')->update([ + 'ordernum' => '6', + ]); + + Jemas::on('mysql7')->where('marhun', '=', 'R/T')->update([ + 'ordernum' => '7', + ]); + + Jemas::on('mysql7')->where('marhun', '=', 'K/B')->update([ + 'ordernum' => '8', + ]); + + Jemas::on('mysql7')->where('marhun', '=', 'DNR')->update([ + 'ordernum' => '9', + ]); + + Jemas::on('mysql7')->where('marhun', '=', 'SYE')->update([ + 'ordernum' => '10', + ]); + + Jemas::on('mysql7')->where('marhun', '=', 'WFR')->update([ + 'ordernum' => '11', + ]); + + Jemas::on('mysql7')->where('marhun', '=', 'G/B')->update([ + 'ordernum' => '12', + ]); + + Jemas::on('mysql7')->where('marhun', '=', 'SPE')->update([ + 'ordernum' => '13', + ]); + + Jemas::on('mysql7')->where('marhun', '=', 'R/L')->update([ + 'ordernum' => '14', + ]); + } +}