Nuevos cambios hechos de diseño

This commit is contained in:
ellecio2
2023-08-23 17:33:44 -04:00
parent 7a806f84ff
commit d2e9ba53ab
3485 changed files with 691106 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers\Seller;
use App\Models\Order;
use App\Models\Product;
use Auth;
use Carbon\Carbon;
use DB;
class DashboardController extends Controller
{
public function index()
{
$data['products'] = filter_products(Product::where('user_id', Auth::user()->id)->orderBy('num_of_sale', 'desc'))->limit(12)->get();
$data['last_7_days_sales'] = Order::where('created_at', '>=', Carbon::now()->subDays(7))
->where('seller_id', '=', Auth::user()->id)
->where('delivery_status', '=', 'delivered')
->select(DB::raw("sum(grand_total) as total, DATE_FORMAT(created_at, '%d %b') as date"))
->groupBy(DB::raw("DATE_FORMAT(created_at, '%Y-%m-%d')"))
->get()->pluck('total', 'date');
return view('seller.dashboard', $data);
}
}