statistics completed added new Models

This commit is contained in:
merdiano 2019-07-23 15:42:23 +05:00
parent 0f8232e6d9
commit 9bfa65423f
19 changed files with 308 additions and 158 deletions

View File

@ -14,6 +14,7 @@ use App\Models\Category;
use App\Models\CategoryMaterial;
use App\Models\Material;
use App\Models\Order;
use App\Models\UserMaterial;
use App\User;
use Illuminate\Support\Facades\DB;
@ -40,58 +41,81 @@ class AdminController extends Controller
$end_date = request('end_date');
$order = Order::where('payed',1);//count with sum
$users = User::select('id');
$filter_by_date ="";
$userMaterials = UserMaterial::select('id');
//$filter_by_date ="";
if($start_date && $end_date)
{
$filter_by_date = " and (orders.created_at BETWEEN {$start_date} and {$end_date})";
//$filter_by_date = " and (orders.created_at BETWEEN {$start_date} and {$end_date})";
$order->whereBetween('created_at',[date($start_date),date($end_date)]);
$users->whereBetween('created_at',[date($start_date),date($end_date)]);
$userMaterials->whereBetween('created_at',[date($start_date),date($end_date)]);
$this->data['start_date'] = $start_date;
$this->data['end_date'] = $end_date;
}
$this->data['category_views'] = Category::has('likes')->withCount([
'likes as liked' => function ($query) use ($start_date, $end_date) {
$query->select(DB::raw('SUM(likes.liked)'));
if($start_date && $end_date)
$query->whereBetween('likes.updated_at', [request('start_date'), request('end_date')]);
},
'likes as viewed' => function($query) use ($start_date, $end_date){
$query->select(DB::raw('SUM(likes.viewed)'));
if($start_date && $end_date)
$query->whereBetween('likes.updated_at', [request('start_date'), request('end_date')]);
}
])->get();
//dd($this->data['category_views']);
$this->data['category_orders'] = Category::has('orders')->withCount([
'orders as payed' => function($query){
$query->select(DB::raw('SUM(orders.payed)'));
},
'orders as total' => function($query){
$query->select(DB::raw('SUM(orders.price)'));
}
])->get();
$this->data['orders'] = $order->count();
$this->data['users'] = $users->count();
$this->data['like'] = $userMaterials->where('liked',1)->count();
$this->data['title'] = trans('backpack::base.dashboard'); // set the page title
$this->data['views'] = Material::sum('view');
$this->data['like'] = Material::sum('like');
$this->data['views'] = Material::sum('view');//all views
$this->data['watch'] = $userMaterials->count();//all watches by registered users
$this->data['field']['start_name'] = 'start';
$this->data['field']['end_name'] = 'end';
$this->data['field']['label'] = 'range';
// $this->data['categories'] = Category::where('depth',1)
// ->select('categories.*',
// //DB::raw("(Select COUNT(orders.id) From orders
// //Where orders.category_id = categories.id and orders.payed = 1{$filter_by_date}) as orders"),
// //DB::raw("(Select SUM(orders.price) From orders
// //Where orders.category_id = categories.id and orders.payed = 1{$filter_by_date}) as total"),
// DB::raw('SUM(materials.view) as views'),
// DB::raw('SUM(materials.like) as likes'))
//// ->leftJoin('materials','categories.id','=','materials.category_id')
// ->groupBy('categories.id')
// ->get();
// $query = "Select categories.id, categories.name, Sum(likes.liked) as liked, Sum(likes.viewd) as viewed
// FROM categories, likes, orders
// WHERE likes.material_id IN (SELECT category_material.material_id
// FROM category_material
// WHERE category_material.category_id = categories.id)
// AND likes.updated_at BETWEEN {$start_date} and {$end_date})
// GROUP BY categories.id";
$this->data['categories'] = CategoryMaterial::with(['category:name,id'])
->selectRaw('category_id, SUM(orders_count) as orders, SUM(orders_payed_count) as total, SUM(views) as views, SUM(likes) as likes')
->groupBy('category_id')
->distinct('category_id')
->get();
//dd($this->data['categories']);
return view('backpack::dashboard', $this->data);
}
public function cat_stats($cat_id){
$start_date = request('start_date');
$end_date = request('end_date');
$filter_by_date ="";
$filter_orders ="";
$filter_likes ="";
if($start_date && $end_date)
$filter_by_date = " and (orders.created_at BETWEEN {$start_date} and {$end_date})";
{
$filter_orders = " and (orders.updated_at BETWEEN {$start_date} and {$end_date})";
$filter_likes = " and (likes.updated_at BETWEEN {$start_date} and {$end_date})";
}
$category = Category::findOrfail($cat_id);
$materials= $category->materials()
->select('materials.title','materials.view','materials.like',
->select('materials.title',
DB::raw("(Select COUNT(likes.viewed) From likes
Where likes.material_id = materials.id {$filter_likes}) as view"),
DB::raw("(Select SUM(likes.liked) From likes
Where likes.material_id = materials.id {$filter_likes}) as likes"),
DB::raw("(Select COUNT(orders.id) From orders
Where orders.material_id = materials.id and orders.payed = 1{$filter_by_date}) as orders"),
Where orders.material_id = materials.id and orders.payed = 1{$filter_orders}) as orders"),
DB::raw("(Select SUM(orders.price) From orders
Where orders.material_id = materials.id and orders.payed = 1{$filter_by_date}) as total"))
Where orders.material_id = materials.id and orders.payed = 1{$filter_orders}) as total"))
->get();
return view('vendor.backpack.material_stats')
->with(['category' => $category, 'materials' => $materials]);

View File

@ -48,7 +48,7 @@ class MaterialCrudController extends CrudController
'model' => "App\Models\Category", // foreign key model
],
['name' => 'view','type' => 'text', 'lable' => trans('admin.view')],
['name' => 'like','type' => 'text', 'lable' => trans('admin.like')],
['name' => 'total_likes','type' => 'text', 'lable' => trans('admin.like')],
['name' => 'price','type' => 'text', 'lable' => trans('admin.price')],
['name' => 'size','type' => 'text', 'lable' => trans('admin.size')],
['name' => 'duration','type' => 'text', 'lable' => trans('admin.duration')],

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Http\Requests\ProfileRequest;
use App\Models\Category;
use App\Models\CategoryMaterial;
use App\Models\UserMaterial;
use App\Models\Material;
use App\Models\Order;
use Carbon\Carbon;
@ -94,7 +95,7 @@ class HomeController extends Controller
}
else{
request()->session()->flash('status','danger');
request()->session()->flash('status_message','Indirme wagtynyz yada gezeginiz gutardy.');
request()->session()->flash('status_message','Indirme wagtyňyz ýada gezegiňiz gutardy.');
redirect()->back();
}
//todo else show expired message
@ -106,37 +107,46 @@ class HomeController extends Controller
public function material($material_id){
$material = Material::findOrFail($material_id);
$watch_list_cookie = Cookie::get('watchlist');
$liked = false;
$order = null;
if(auth()->guest()){
$watch_list_cookie = Cookie::get('watchlist');
$material->view ++;
$material->save();
CategoryMaterial::where('material_id',$material_id)
->update(['views'=> DB::raw('views + 1')]);
// dd($material->details);
if(!$watch_list_cookie){
$watch_list = [1 => $material_id];
Cookie::queue('watchlist', json_encode($watch_list), 450000);
}
else{
$watch_list = json_decode($watch_list_cookie,true);
//dd($watch_list);
if(!array_search($material_id,$watch_list)){
$watch_list[]=$material_id;
if(!$watch_list_cookie){
$watch_list = [1 => $material_id];
Cookie::queue('watchlist', json_encode($watch_list), 450000);
$material->view ++;
$material->save();
}
else{
$watch_list = json_decode($watch_list_cookie,true);
if(!array_search($material_id,$watch_list)){
$watch_list[]=$material_id;
$material->view ++;
$material->save();
Cookie::queue('watchlist', json_encode($watch_list), 450000);
}
}
}
else{
$um = UserMaterial::firstOrCreate(
['user_id' => auth()->id(), 'material_id' => $material_id],
['watched'=>1, 'liked'=>0]
);
if($um->wasRecentlyCreated){
$material->veiw++;
$material->save();
}
$liked = $um->liked;
$order = Order::where('user_id',auth()->id())
->where('material_id',$material_id)
->where('payed',1)
->first();
}
// Cookie::queue('watchlist', json_encode([$material_id]), 450000);
// Cookie::queue('wishlist', $material_id, 450000);
// dd(Cookie::get('watchlist'));
// cookie()->forever('watchlist',$material_id,450000);
$like_list_cookie = Cookie::get('likelist');
$order = Order::where('user_id',auth()->id())
->where('material_id',$material_id)
->where('payed',1)
->first();
// CategoryMaterial::where('material_id',$material_id)
// ->update(['views'=> DB::raw('views + 1')]);
if(!empty($order)){
@ -147,9 +157,6 @@ class HomeController extends Controller
}
}
$liked = !empty($like_list_cookie)
&& array_search($material_id, json_decode($like_list_cookie,true));
return view('material',compact('material'))
->with('liked',$liked)
->with('order',$order);
@ -157,64 +164,46 @@ class HomeController extends Controller
}
public function like($material_id){
//todo ajax post
$material = Material::findOrFail($material_id);
$like_list_cookie = Cookie::get('likelist');
if(!$like_list_cookie){
$like_list = [1 => $material_id];
Cookie::queue('likelist', json_encode($like_list), 450000);
$material->like ++;
$material = Material::findOrFail($material_id);
$um = UserMaterial::where([
'user_id'=>auth()->id(),
'material_id' =>$material_id])
->first();
if(!$um->liked)
{
$material->like++;
$material->save();
CategoryMaterial::where('material_id',$material_id)
->update(['likes'=> DB::raw('likes + 1')]);
$um->liked = true;
$um->save();
}
else{
$like_list = json_decode($like_list_cookie,true);
//dd($watch_list);
if(!array_search($material_id,$like_list)){
$like_list[]=$material_id;
$material->like ++;
$material->save();
CategoryMaterial::where('material_id',$material_id)
->update(['likes'=> DB::raw('likes + 1')]);
Cookie::queue('likelist', json_encode($like_list), 450000);
}
}
// return view('material',compact('material'))->with('cat',$material->category);
return $material->like;
}
public function watch_list(){
$watch_list = json_decode(Cookie::get('watchlist'),true);
$materials = null;
if($watch_list){
$material_ids = array_values($watch_list);
$materials = Material::whereIn('id',$material_ids)->paginate(6);
}
$materials = Material::join('user_materials','user_materials.material_id','materials.id')
->where('user_materials.user_id',auth()->id())
->where('user_materials.watched',1)
->paginate(6);
return view('watched',compact('materials'));
}
public function like_list(){
$like_list = json_decode(Cookie::get('likelist'),true);
$request = \request();
$sort = $request['sort'];
$sort = $sort ?? 'high';
$materials = null;
if($like_list){
$material_ids = array_values($like_list);
$materials = Material::whereIn('id',$material_ids);
switch ($sort){
case 'high':
$materials->orderBy('like','DESC');
break;
case 'low':
$materials->orderBy('like','ASC');
break;
}
$materials = $materials->paginate(6);
$sort = request('sort','high');
$materials = Material::join('user_materials','user_materials.material_id','materials.id')
->where('user_materials.user_id',auth()->id())
->where('user_materials.liked',1);
switch ($sort){
case 'high':
$materials->orderBy('like','DESC');
break;
case 'low':
$materials->orderBy('like','ASC');
break;
}
$materials = $materials->paginate(6);
return view('liked',compact('materials'))->with('sort',$sort);
}

View File

@ -38,6 +38,18 @@ class Category extends Model
public function materials(){
return $this->belongsToMany(Material::class,'category_material');
}
public function likes()
{
return $this->belongsToMany(UserMaterial::class, 'category_material', 'category_id',
'material_id', 'id', 'material_id');
}
public function orders(){
return $this->belongsToMany(Order::class,'category_material','category_id',
'material_id','id','material_id');
}
/*
|--------------------------------------------------------------------------
| SCOPES

View File

@ -50,15 +50,27 @@ class Material extends Model
public function categories(){
return $this->belongsToMany(Category::class,'category_material');
}
public function likes(){
return $this->hasMany(UserMaterial::class);
}
public function orders(){
return $this->belongsTo(Order::class);
}
/*
|--------------------------------------------------------------------------
| SCOPES
|--------------------------------------------------------------------------
*/
public function getTotalLikesAttribute()
{
return $this->likes()->whereMaterialId($this->material_id)->whereLiked(1)->count();
}
/*
|--------------------------------------------------------------------------
| ACCESORS

View File

@ -0,0 +1,19 @@
<?php
namespace App\Models;
use App\User;
use Illuminate\Database\Eloquent\Model;
class UserMaterial extends Model
{
protected $table = 'likes';
public function user(){
return $this->belongsTo(User::class);
}
public function material(){
return $this->belongsTo(Material::class);
}
}

View File

@ -2,6 +2,7 @@
namespace App;
use App\Models\UserMaterial;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
@ -36,4 +37,8 @@ class User extends Authenticatable
protected $casts = [
'email_verified_at' => 'datetime',
];
public function likes(){
return $this->hasMany(UserMaterial::class);
}
}

View File

@ -37,7 +37,7 @@ return [
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| users of the application. UserMaterial the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/

View File

@ -32,8 +32,8 @@ class AddToCategoryMaterialTable extends Migration
public function down()
{
Schema::table('category_material', function (Blueprint $table) {
$table->dropColumn('view');
$table->dropColumn('like');
$table->dropColumn('views');
$table->dropColumn('likes');
$table->dropColumn('orders_count');
$table->dropColumn('orders_payed_count');
$table->dropColumn('orders_total_amount');

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserMaterialsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('likes', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->unsignedBigInteger('material_id');
$table->foreign('material_id')->references('id')->on('materials');
$table->boolean('watched')->default(0);
$table->boolean('liked')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('likes');
}
}

View File

@ -2706,7 +2706,7 @@
else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||
mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )
{
/* Like the get, we need to get data from a nested object */
/* UserMaterial the get, we need to get data from a nested object */
var setData = function (data, val, src) {
var a = _fnSplitObjNotation( src ), b;
var aLast = a[a.length-1];
@ -7634,7 +7634,7 @@
* Load data from the newly set Ajax URL. Note that this method is only
* available when `ajax.url()` is used to set a URL. Additionally, this method
* has the same effect as calling `ajax.reload()` but is provided for
* convenience when setting a new URL. Like `ajax.reload()` it will
* convenience when setting a new URL. UserMaterial `ajax.reload()` it will
* automatically redraw the table once the remote data has been loaded.
*
* @returns {DataTables.Api} this
@ -12395,7 +12395,7 @@
* when you want to manipulate data for display (including filtering,
* sorting etc) without altering the underlying data for the table, use this
* property. `render` can be considered to be the the read only companion to
* `data` which is read / write (then as such more complex). Like `data`
* `data` which is read / write (then as such more complex). UserMaterial `data`
* this option can be given in a number of different ways to effect its
* behaviour:
*

View File

@ -2706,7 +2706,7 @@
else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||
mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )
{
/* Like the get, we need to get data from a nested object */
/* UserMaterial the get, we need to get data from a nested object */
var setData = function (data, val, src) {
var a = _fnSplitObjNotation( src ), b;
var aLast = a[a.length-1];
@ -7634,7 +7634,7 @@
* Load data from the newly set Ajax URL. Note that this method is only
* available when `ajax.url()` is used to set a URL. Additionally, this method
* has the same effect as calling `ajax.reload()` but is provided for
* convenience when setting a new URL. Like `ajax.reload()` it will
* convenience when setting a new URL. UserMaterial `ajax.reload()` it will
* automatically redraw the table once the remote data has been loaded.
*
* @returns {DataTables.Api} this
@ -12396,7 +12396,7 @@
* when you want to manipulate data for display (including filtering,
* sorting etc) without altering the underlying data for the table, use this
* property. `render` can be considered to be the the read only companion to
* `data` which is read / write (then as such more complex). Like `data`
* `data` which is read / write (then as such more complex). UserMaterial `data`
* this option can be given in a number of different ways to effect its
* behaviour:
*

View File

@ -2713,7 +2713,7 @@
else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||
mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )
{
/* Like the get, we need to get data from a nested object */
/* UserMaterial the get, we need to get data from a nested object */
var setData = function (data, val, src) {
var a = _fnSplitObjNotation( src ), b;
var aLast = a[a.length-1];
@ -7673,7 +7673,7 @@
* Load data from the newly set Ajax URL. Note that this method is only
* available when `ajax.url()` is used to set a URL. Additionally, this method
* has the same effect as calling `ajax.reload()` but is provided for
* convenience when setting a new URL. Like `ajax.reload()` it will
* convenience when setting a new URL. UserMaterial `ajax.reload()` it will
* automatically redraw the table once the remote data has been loaded.
*
* @returns {DataTables.Api} this
@ -12416,7 +12416,7 @@
* when you want to manipulate data for display (including filtering,
* sorting etc) without altering the underlying data for the table, use this
* property. `render` can be considered to be the the read only companion to
* `data` which is read / write (then as such more complex). Like `data`
* `data` which is read / write (then as such more complex). UserMaterial `data`
* this option can be given in a number of different ways to effect its
* behaviour:
*

View File

@ -20,7 +20,7 @@ return[
'duration' => 'Duration',
'size' => 'Size',
'price' => 'Price',
'like' => 'Like',
'like' => 'UserMaterial',
'view' => 'View',
'title' => 'Title',
'desc' => 'Description',

View File

@ -3,7 +3,7 @@
<div class="video-poster" style="background-image: url({{asset($material->banner_url)}}); background-size: cover; background-position: center, center; height: 230px">
<span class="eye-eye"><i class="fa fa-eye"></i> {{$material->view}}</span>
<span class="day-day">{{$material->created_at}}</span>
<span class="like-clicked counter-anim" style="position: absolute; width: 75px; bottom: 0;"><i class="fa fa-heart-o"></i> {{$material->like}}</span>
<span class="like-clicked counter-anim" style="position: absolute; width: 75px; bottom: 0;"><i class="fa fa-heart-o"></i> {{$material->total_likes}}</span>
<span class="min-min"><i class="fa fa-clock-o"></i> {{$material->duration}} <i style="font-size: 12px; font-style: normal; font-weight: normal">@lang('content.min')</i></span>
<img class="bg-gradient" src="{{asset('static/img/tv-projects/shadow.png')}}">
<img class="play-icon" src="{{asset('static/img/tv-projects/play-btn.png')}}">

View File

@ -5,7 +5,7 @@
<li><a href="{{ backpack_url('material') }}"><i class="fa fa-video-camera"></i> <span>{{ trans('admin.materials') }}</span></a></li>
<li><a href="{{ backpack_url('elfinder') }}"><i class="fa fa-files-o"></i> <span>{{ trans('backpack::crud.file_manager') }}</span></a></li>
<li><a href="{{ backpack_url('order') }}"><i class='fa fa-cubes'></i> <span>Sargytlar</span></a></li>
<li><a href="{{ backpack_url('user') }}"><i class="fa fa-user"></i> <span>Ulanyjylar</span></a></li>
<li class="header">Web</li>
<li><a href="{{backpack_url('page') }}"><i class="fa fa-file"></i> <span>Sahypalar</span></a></li>
<li><a href="{{backpack_url('menu') }}"><i class="fa fa-cubes"></i> <span>Menýular</span></a></li>

View File

@ -3,23 +3,59 @@
@section('header')
<link rel="stylesheet" href="{{ asset('/vendor/adminlte/bower_components/bootstrap-daterangepicker/daterangepicker.css') }}">
<section class="content-header">
<h1>
Stats
</h1>
<div class="row">
<div class="col-md-3">
<h1>
Stats
</h1>
</div>
</div>
<ol class="breadcrumb">
<li><a href="{{ backpack_url() }}">{{ config('backpack.base.project_name') }}</a></li>
<li class="active">{{ trans('backpack::base.dashboard') }}</li>
</ol>
</section>
@endsection
@section('content')
<div class="row" style="margin-top: -65px;">
<div class="col-md-3"></div>
<div class="col-md-5 m-b-10">
<form id="dateFilter" action="{{backpack_url('dashboard')}}" method="GET">
<input class="datepicker-range-start" type="hidden" name="start_date" value="{{ old('start_date')}}">
<input class="datepicker-range-end" type="hidden" name="end_date" value="{{ old('end_date') }}">
<label>Date Range</label>
<div class="input-group date">
<input
data-bs-daterangepicker="{}"
type="text"
@include('crud::inc.field_attributes')
>
<div class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</div>
</div>
</form>
</div>
</div>
{{-- HINT --}}
@if (isset($field['hint']))
<p class="help-block">{!! $field['hint'] !!}</p>
@endif
<div class="row">
<div class="col-md-9">
<div class="box box-success box-solid">
<div class="box-header with-border">
<h3 class="box-title">Category Statistics</h3>
<h3 class="box-title">Views And Likes</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
@ -29,51 +65,67 @@
</div>
<!-- /.box-header -->
<div class="box-body" style="">
<div class="row text-center">
<div class="col-xs-offset-4 col-xs-4" >
<form id="dateFilter" action="{{backpack_url('dashboard')}}" method="GET">
<input class="datepicker-range-start" type="hidden" name="start_date" value="{{ old('start_date')}}">
<input class="datepicker-range-end" type="hidden" name="end_date" value="{{ old('end_date') }}">
<label>Date Range</label>
<div class="input-group date">
<input
data-bs-daterangepicker="{}"
type="text"
@include('crud::inc.field_attributes')
>
<div class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</div>
</div>
</form>
{{-- HINT --}}
@if (isset($field['hint']))
<p class="help-block">{!! $field['hint'] !!}</p>
@endif
</div>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Orders count</th>
<th>Total sold</th>
{{--<th>Orders count</th>--}}
{{--<th>Total sold</th>--}}
<th>Views count</th>
<th>Likes count</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($categories as $category)
@foreach($category_views as $category)
<tr>
<td>{{$category->category->name}}</td>
<td>{{$category->orders}}</td>
<td>{{$category->name}}</td>
{{--<td>{{$category->ordered}}</td>--}}
{{--<td>{{$category->total}}</td>--}}
<td>{{$category->viewed}}</td>
<td>{{$category->liked}}</td>
<td><a href="{{route('cat_stats',$category->id)}}">details</a> </td>
</tr>
@endforeach
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
<div class="box box-success box-solid">
<div class="box-header with-border">
<h3 class="box-title">Orders</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
</button>
</div>
<!-- /.box-tools -->
</div>
<!-- /.box-header -->
<div class="box-body" style="">
<table class="table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Orders count</th>
<th>Total sold</th>
{{--<th>Views count</th>--}}
{{--<th>Likes count</th>--}}
<th></th>
</tr>
</thead>
<tbody>
@foreach($category_orders as $category)
<tr>
<td>{{$category->name}}</td>
<td>{{$category->payed}}</td>
<td>{{$category->total}}</td>
<td>{{$category->views}}</td>
<td>{{$category->likes}}</td>
<td><a href="{{route('cat_stats',$category->category->id)}}">details</a> </td>
{{--<td>{{$category->viewed}}</td>--}}
{{--<td>{{$category->liked}}</td>--}}
<td><a href="{{route('cat_stats',$category->id)}}">details</a> </td>
</tr>
@endforeach
</tbody>
@ -153,6 +205,7 @@
jQuery(document).ready(function($){
var $fake = $('[data-bs-daterangepicker]'),
$start = $fake.parents('.form-group').find('.datepicker-range-start'),
$end = $fake.parents('.form-group').find('.datepicker-range-end'),
$customConfig = $.extend({
format: 'dd/mm/yyyy',

View File

@ -15,7 +15,7 @@
<div class="row">
<div class="box box-warning box-solid">
<div class="box-header with-border">
<h3 class="box-title">Category Statistics</h3>
<h3 class="box-title">Category statistics for : {{$category->name}}</h3>
<div class="box-tools pull-right">
@ -71,7 +71,7 @@
<td>{{$material->orders}}</td>
<td>{{$material->total}}</td>
<td>{{$material->view}}</td>
<td>{{$material->like}}</td>
<td>{{$material->likes}}</td>
</tr>
@endforeach
</tbody>

View File

@ -45,8 +45,7 @@ Breadcrumbs::for('category', function ($trail, $category) {
$trail->parent('main');
if($category)
$trail->push($category->name, route('category', $category->id));
else
$trail->push('Ählisi',route('home'));
});
Breadcrumbs::for('material', function ($trail, $material) {