wip
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Entrepreneur;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class VendorMetricsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$channel = auth()->user()->channel();
|
||||
|
||||
$products_count = $channel->products()->count();
|
||||
$order_items = DB::table('order_items')->where('channel_id', $channel->id)->count();
|
||||
$order_items_today = DB::table('order_items')->where('channel_id', $channel->id)->whereDate('created_at', Carbon::today())->count();
|
||||
|
||||
return response()->rest([
|
||||
'products_count' => $products_count,
|
||||
'order_items_count' => $order_items,
|
||||
'order_items_today_count' => $order_items_today,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user