This commit is contained in:
gholak tala
2026-01-24 14:03:11 +00:00
parent 7dcd83715a
commit eb26afbcb3
224 changed files with 32652 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
<?php
namespace App\Http\Controllers\Admin;
use App\DB\Te\TableEngine;
use App\Http\Controllers\Controller;
use App\Models\Price;
use App\Models\PriceCandle;
use Illuminate\Http\Request;
class PriceController extends Controller
{
public function store(Request $request){
Price::create([
"price"=>$request->price ,
"date_at"=>date("Y-m-d"),
"time_at"=>now()->format("H:m:s"),
"user_id"=>auth('user')->id()
]);
$candle = PriceCandle::whereDate('date_at',date("Y-m-d"))->first();
if (!is_null($candle)){
$candle->end = $request->price;
if ($request->price < $candle->low){
$candle->low = $request->price;
}
elseif ($request->price > $candle->high){
$candle->high = $request->price;
}
$candle->save();
}else{
PriceCandle::create([
"start"=>$request->price,
"end"=>$request->price,
"high"=>$request->price,
"low"=>$request->price,
"date_at"=>date("Y-m-d")
]);
}
return response()->json(true);
}
public function priceData(Request $request){
$prise = Price::with('order');
TableEngine::create($prise, $request)
->initSearch(['price'])
->select(['*'])
->export($prise);
return response()->json($prise);
}
public function table(Request $request){
$records = Price::with(['user']);
TableEngine::create($records, $request->all())
->initSearch([])
->select([
'*'
])->export($records);
return response()->json($records);
}
}