This commit is contained in:
tmStore 2019-07-10 21:12:05 +05:00
commit 9cbd8dd0ef
59 changed files with 397 additions and 64 deletions

View File

@ -11,6 +11,7 @@ namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Category;
use App\Models\CategoryMaterial;
use App\Models\Material;
use App\Models\Order;
use App\User;
@ -56,18 +57,24 @@ class AdminController extends Controller
$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();
// $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();
$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);
}
@ -79,7 +86,7 @@ class AdminController extends Controller
$filter_by_date = " and (orders.created_at BETWEEN {$start_date} and {$end_date})";
$category = Category::findOrfail($cat_id);
$materials= Material::where('category_id',$cat_id)
$materials= $category->materials()
->select('materials.title','materials.view','materials.like',
DB::raw("(Select COUNT(orders.id) From orders
Where orders.material_id = materials.id and orders.payed = 1{$filter_by_date}) as orders"),

View File

@ -6,7 +6,7 @@ use Backpack\CRUD\app\Http\Controllers\CrudController;
// VALIDATION: change the requests to match your own file names if you need form validation
use App\Http\Requests\MaterialRequest as StoreRequest;
use App\Http\Requests\MaterialRequest as UpdateRequest;
use App\Http\Requests\MaterialRequest as UpdateRequest;
use Backpack\CRUD\CrudPanel;
/**
@ -38,6 +38,15 @@ class MaterialCrudController extends CrudController
$this->crud->addColumns([
['name' => 'title','type' => 'text', 'lable' => trans('admin.title')],
[
// n-n relationship (with pivot table)
'label' => "Categories", // Table column heading
'type' => "select_multiple",
'name' => 'categories', // the method that defines the relationship in your Model
'entity' => 'categories', // the method that defines the relationship in your Model
'attribute' => "name", // foreign key attribute that is shown to user
'model' => "App\Models\Category", // foreign key model
],
['name' => 'view','type' => 'text', 'lable' => trans('admin.view')],
['name' => 'rating','type' => 'text', 'lable' => trans('admin.like')],
['name' => 'price','type' => 'text', 'lable' => trans('admin.price')],
@ -49,24 +58,25 @@ class MaterialCrudController extends CrudController
$this->crud->addFields([
['name' => 'title','type' => 'text', 'lable' => trans('admin.title'),'tab' => trans('admin.material.firsttab')],
['name' => 'category_id', 'type' => 'select', 'entity' => 'category', 'attribute' =>'name', 'model' => 'App\Models\Category',
'lable'=>trans('admin.category'), 'tab' => trans('admin.material.firsttab')],
[
'name' => 'categories',
'type' => 'select2_multiple',
'entity' => 'categories',
'attribute' =>'name',
'model' => 'App\Models\Category',
'pivot' => true,
'lable'=>trans('admin.category'), 'tab' => trans('admin.material.firsttab')
],
['name' => 'desc','type' => 'textarea', 'lable' => trans('admin.desc'),'tab' => trans('admin.material.firsttab')],
['suffix' => 'manat','name' => 'price','type' => 'number', 'lable' => trans('admin.price'),'tab' => trans('admin.material.secondtab')],
['suffix'=>'kilobyte','name' => 'size','type' => 'number', 'lable' => trans('admin.size'),'tab' => trans('admin.material.secondtab')],
['suffix'=>'minut','name' => 'duration','type' => 'number', 'lable' => trans('admin.duration'),'tab' => trans('admin.material.secondtab')],
['suffix' => 'man.','attributes' => ["step" => "any"],'name' => 'price','type' => 'number', 'lable' => trans('admin.price'),'tab' => trans('admin.material.secondtab')],
['suffix'=>'Mb','attributes' => ["step" => "any"],'name' => 'size','type' => 'number', 'lable' => trans('admin.size'),'tab' => trans('admin.material.secondtab')],
['suffix'=>'min.','attributes' => ["step" => "any"],'name' => 'duration','type' => 'number', 'lable' => trans('admin.duration'),'tab' => trans('admin.material.secondtab')],
[ // image
'tab' => trans('admin.material.thirdtab'),
'label' => "Material Image",
'label' => trans('admin.material_image'),
'name' => "banner_url",
'type' => 'image',
'upload' => true,
'crop' => true, // set to true to allow cropping, false to disable
'aspect_ratio' => 2, // ommit or set to 0 to allow any aspect ratio
//'disk' => 'uploads', // in case you need to show images from a different disk
'prefix' => 'uploads/' // in case your db value is only the file name (no path), you can use this to prepend your path to the image src (in HTML), before it's shown to the user;
],
'type' => 'browse'],
['name' => 'trailer_url','type' => 'browse', 'lable' => trans('admin.trailer_url'),'tab' => trans('admin.material.thirdtab')],
['name' => 'content_url','type' => 'browse', 'lable' => trans('admin.content_url'),'tab' => trans('admin.material.thirdtab')],
['name' => 'day_count','type' => 'number', 'lable' => trans('admin.day_count'),'tab' => trans('admin.material.secondtab')],

View File

@ -4,11 +4,13 @@ namespace App\Http\Controllers;
use App\Http\Requests\ProfileRequest;
use App\Models\Category;
use App\Models\CategoryMaterial;
use App\Models\Material;
use App\Models\Order;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class HomeController extends Controller
@ -27,18 +29,16 @@ class HomeController extends Controller
*/
public function index(){
$cat = Category::where('depth',1)
->orderBy('lft')->firstOrFail();
$materials = Material::where('category_id',$cat->id)->paginate(6);
// $cat = Category::where('depth',1)
// ->orderBy('lft')->firstOrFail();
$materials = Material::paginate(6);
return view('main')->with([
'cat' => $cat,
'cat' => "",
'materials' => $materials,
'sort' => 'all'
]);
}
public function category($cat_id){
//dd(\request());
$request = \request();
@ -46,8 +46,15 @@ class HomeController extends Controller
$sort = $sort ?? 'all';
//dd($request['sort']);
//todo restrict sort to be only {'all','rate','date'}
$cat = Category:: findOrFail($cat_id);
$materials = Material::where('category_id',$cat_id);
if($cat_id != 0){
$cat = Category:: findOrFail($cat_id);
$materials = $cat->materials();
}
else{
$cat = '';
$materials = Material::query();
}
switch ($sort){
case 'rate':
$materials->orderBy('like','DESC');
@ -64,10 +71,10 @@ class HomeController extends Controller
'sort' => $sort
]);
}
public function download($material_id){
//todo check limits
$material = Material::findOrFail($material_id);
$order = Order::where('user_id',auth()->id())
->where('material_id',$material_id)
->where('payed',1)
@ -102,6 +109,8 @@ class HomeController extends Controller
$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];
@ -119,11 +128,10 @@ class HomeController extends Controller
// Cookie::queue('watchlist', json_encode([$material_id]), 450000);
// Cookie::queue('wishlist', $material_id, 450000);
// cookie()->forever('watchlist',$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)
@ -143,8 +151,8 @@ class HomeController extends Controller
return view('material',compact('material'))
->with('liked',$liked)
->with('order',$order)
->with('cat',$material->category);
->with('order',$order);
// ->with('cat',$material->category);
}
public function like($material_id){
@ -157,6 +165,8 @@ class HomeController extends Controller
Cookie::queue('likelist', json_encode($like_list), 450000);
$material->like ++;
$material->save();
CategoryMaterial::where('material_id',$material_id)
->update(['likes'=> DB::raw('likes + 1')]);
}
else{
$like_list = json_decode($like_list_cookie,true);
@ -165,6 +175,8 @@ class HomeController extends Controller
$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);
}
}
@ -205,13 +217,16 @@ class HomeController extends Controller
return view('liked',compact('materials'))->with('sort',$sort);
}
public function orders_list(){
$orders = Order::where('user_id',auth()->id())->paginate(20);
return view('orders',compact('orders'));
}
public function bought_list(){
$orders = Order::with('material')
->where('user_id',auth()->id())
// ->where('payed',0)
->where('payed',1)
->paginate(6);
// dd($orders);/
//todo change payed true
return view('bought',compact('orders'));
}

View File

@ -34,6 +34,7 @@ class OrderController extends Controller
$order->oid = str_replace('-','',Str::orderedUuid());
$order->save();
//todo update order_count on category_material
return $this->register($order);
}
@ -94,6 +95,9 @@ class OrderController extends Controller
public function result($order_id){
$order = Order::findOrFail($order_id);
if($order->payed){
return view('order_complete')->with('order',$order);
}
$url = config('app.gateway_url');
$user = config('app.gateway_user');
$pwd = config('app.gateway_password');
@ -116,17 +120,36 @@ class OrderController extends Controller
]
]);
$data = json_decode($response->getBody(), true);
$order->errorCode = $data['ErrorCode'];
$order->orderStatus = $data['OrderStatus'];
if($data['ErrorCode'] == 0){
if($data['OrderStatus'] == 2){ //payment successfull
$order->payed = 1;
// $this->makePayment($order);
request()->session()->flash('status','success');
request()->session()->flash('status_message',trans('abonent.payment_successfull'));
//$order->errorMessage = trans('abonent.payment_successfull');
$status_message = 'Проведена полная авторизация суммы заказа';
}
elseif($data['OrderStatus'] == 0){//order registered but not payed yet
$status_message = 'Заказ зарегистрирован, но не оплачен';
}
elseif ($data['OrderStatus'] == 1){//Предавторизованная сумма захолдирована (для двухстадийных платежей)
$status_message ='Предавторизованная сумма захолдирована (для двухстадийных платежей)';
}
elseif ($data['OrderStatus'] == 4){//Предавторизованная сумма захолдирована (для двухстадийных платежей)
$status_message ='По транзакции была проведена операция возврата';
}
elseif ($data['OrderStatus'] == 5){//Предавторизованная сумма захолдирована (для двухстадийных платежей)
$status_message ='Инициирована авторизация через ACS банка-эмитента';
}
else{//unsuccessfull Авторизация отменена
$status_message ='Авторизация отменена';
}
}
else{
// $order->status = 'payment_failed';
$order->errorCode = $data['ErrorCode'];
$order->errorMessage = $data['ErrorMessage'];
}
$order->save();

View File

@ -27,7 +27,11 @@ class MaterialRequest extends FormRequest
{
return [
'title' => 'required|min:5|max:255',
'category_id' => 'required|integer'
'desc' => 'required',
'price' => 'required|numeric',
'size' => 'required|numeric',
'duration' => 'required|numeric',
// 'category_id' => 'required|integer'
];
}

View File

@ -36,7 +36,7 @@ class Category extends Model
*/
public function materials(){
return $this->hasMany(Material::class);
return $this->belongsToMany(Material::class,'category_material');
}
/*
|--------------------------------------------------------------------------

View File

@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CategoryMaterial extends Model
{
public $timestamps = false;
protected $table = 'category_material';
public function category(){
return $this->belongsTo(Category::class);
}
public function material(){
return $this->belongsTo(Material::class);
}
}

View File

@ -4,6 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\CrudTrait;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Str;
//use Illuminate\Support\Facades\Storage;
@ -11,7 +12,7 @@ use Illuminate\Support\Str;
class Material extends Model
{
use CrudTrait;
use SoftDeletes;
/*
|--------------------------------------------------------------------------
| GLOBAL VARIABLES
@ -46,8 +47,8 @@ class Material extends Model
|--------------------------------------------------------------------------
*/
public function category(){
return $this->belongsTo(Category::class);
public function categories(){
return $this->belongsToMany(Category::class,'category_material');
}
public function orders(){
return $this->belongsTo(Order::class);

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddToOrdersTable2 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('orders', function (Blueprint $table) {
$table->smallInteger('orderStatus')->nullable();
//
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('orders', function (Blueprint $table) {
//
$table->dropColumn('orderStatus');
});
}
}

View File

@ -0,0 +1,48 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AlterMaterialsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('materials', function (Blueprint $table) {
$table->dropColumn('duration');
$table->dropForeign(['category_id']);
$table->dropColumn('category_id');
// $table->unsignedDecimal('duration')->nullable();
//
});
Schema::table('materials', function (Blueprint $table) {
// $table->dropColumn('duration');
$table->unsignedDecimal('duration')->nullable();
//
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('materials', function (Blueprint $table) {
//
$table->dropColumn('duration');
// $table->unsignedInteger('duration')->nullable();
});
Schema::table('materials', function (Blueprint $table) {
//
// $table->dropColumn('duration');
$table->unsignedInteger('duration')->nullable();
});
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddToMaterialsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('materials', function (Blueprint $table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('materials', function (Blueprint $table) {
$table->dropSoftDeletes();
});
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCategoryMaterialTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('category_material', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('category_id');
$table->unsignedBigInteger('material_id');
// $table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('category_material');
}
}

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddToCategoryMaterialTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('category_material', function (Blueprint $table) {
$table->unsignedBigInteger('views')->nullable();
$table->unsignedBigInteger('likes')->nullable();
$table->unsignedBigInteger('orders_count')->nullable();
$table->unsignedBigInteger('orders_payed_count')->nullable();
$table->unsignedBigInteger('orders_total_amount')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('category_material', function (Blueprint $table) {
$table->dropColumn('view');
$table->dropColumn('like');
$table->dropColumn('orders_count');
$table->dropColumn('orders_payed_count');
$table->dropColumn('orders_total_amount');
});
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 934 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -15,6 +15,7 @@ return[
'material.thirdtab' => 'Üçünji',
'material.fourthtab' => 'Dördünji',
'material.extras' => 'Goşmaça',
'material.image' => 'Cover Image',
'download_count' => 'Download limidy',
'day_count' => 'Download gün limidy',
'duration' => 'Dowam wagty',
@ -22,7 +23,7 @@ return[
'price' => 'Bahasy',
'like' => 'Halandy',
'view' => 'Görüldi',
'title' => 'Mazmuny',
'title' => 'Ady',
'desc' => 'Beýany',
'banner_url' => 'Suraty',
'trailer_url' => 'Media treýleri',

View File

@ -8,6 +8,7 @@
return [
'profile' => 'Şahsy maglumatlar',
'bought' => 'Satyn alynanlar',
'orders' => 'Sargytlar',
'liked' => 'Halananlar',
'watched' => 'Seredilenler',
'sort_desc' => 'Köpden aza',

View File

@ -10,6 +10,9 @@
<li class="@if(Route::currentRouteName()=='bought') active @endif">
<a href="{{route('bought')}}">@lang('content.bought')</a>
</li>
<li class="@if(Route::currentRouteName()=='orders') active @endif">
<a href="{{route('orders')}}">@lang('content.orders')</a>
</li>
<li class="@if(Route::currentRouteName()=='liked') active @endif" >
<a href="{{route('liked')}}">@lang('content.liked')</a>
</li>

View File

@ -52,6 +52,7 @@
<ul class="dropdown-menu">
<li><a href="{{route('profile')}}" style="padding: 8px">Şahsy maglumatlar <i class="fa fa-angle-right pull-right" style="margin-top: 4px"></i></a></li>
<li><a href="{{route('bought')}}" style="padding: 8px">Satyn alynanlar <i class="fa fa-angle-right pull-right" style="margin-top: 4px"></i></a></li>
<li><a href="{{route('orders')}}" style="padding: 8px">Sargytlar <i class="fa fa-angle-right pull-right" style="margin-top: 4px"></i></a></li>
<li><a href="{{route('liked')}}" style="padding: 8px">Halananlar <i class="fa fa-angle-right pull-right" style="margin-top: 4px"></i></a></li>
<li><a href="{{route('watched')}}" style="padding: 8px">Seredilenler <i class="fa fa-angle-right pull-right" style="margin-top: 4px"></i></a></li>
<li><a onclick="event.preventDefault();

View File

@ -1,5 +1,8 @@
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
<ul>
<li @if(empty($cat))class="active" @endif>
<a href="{{route('home')}}">{{__('Ählisi')}}</a>
</li>
@foreach($mainCategories as $category)
<li @if(!empty($cat) && $category->id == $cat->id)class="active" @endif>
<a href="{{route('category',$category->id)}}">

View File

@ -8,17 +8,17 @@
<div class="tab-content col-lg-9 col-md-9 col-sm-9 col-xs-12">
<div id="redak-tc" class="tab-pane fade active in" role="tabpanel">
<div class="for-padding">
<h2>{{$cat->name}}</h2>
<h2>{{$cat->name ?? 'Ählisi'}}</h2>
<div class="platny-inner-tab">
<ul role="tablist" >
<li class="@if($sort == 'all')active @endif">
<a href="{{route('category',[$cat->id])}}" >@lang('content.all')</a>
<a href="{{route('category',[$cat->id ?? 0])}}" >@lang('content.all')</a>
</li>
<li class="@if($sort == 'rate')active @endif">
<a href="{{route('category',[$cat->id,'sort=rate'])}}">@lang('content.liked')</a>
<a href="{{route('category',[$cat->id ?? 0,'sort=rate'])}}">@lang('content.liked')</a>
</li>
<li class="@if($sort == 'date')active @endif" >
<a href="{{route('category',[$cat->id,'sort=date'])}}">@lang('content.date')</a>
<a href="{{route('category',[$cat->id ?? 0,'sort=date'])}}">@lang('content.date')</a>
</li>
</ul>
<div class="tab-content">

View File

@ -8,7 +8,7 @@
@include('layouts.left_menu')
<div id="redak-tc" class="col-md-9" >
<div class="for-padding">
<a href="{{route('category',$material->category_id)}}"><h2><i style="font-style: normal"><</i> {{$cat->name}}</h2></a>
<h2> {{$material->title}}</h2>
<div class="platny-inner-tab container one-platny">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
@ -22,7 +22,7 @@
</div>
<span class="cost-cost">
<span>{{$material->price}} TMT</span>
<span>Möçberi: <i style="font-style: normal">{{$material->size}}</i> Kb</span>
<span>Möçberi: <i style="font-style: normal">{{$material->size}}</i> Mb</span>
</span>
<span class="eye-eye"><i class="fa fa-eye"></i> {{$material->view}}</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>
@ -60,6 +60,7 @@
</div>
@endsection
@section('footerScripts')
@auth
<script>
$('.like-click').click(function () {
$.get("{{route('like',$material->id)}}",function(data){
@ -71,6 +72,7 @@
})
});
</script>
@endauth
@endsection

View File

@ -12,7 +12,7 @@
<div class="platny-inner-tab container one-platny thanks">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
@if($order->errorCode ==0)
@if($order->errorCode ==0 && $order->orderStatus ==2)
<h3>@lang('content.order_complete_text_header')</h3>
<p>
Satyn alanyňyz üçin minnetdarlyk bildirýäris.
@ -21,12 +21,14 @@
<p>
@lang('content.order_complete_text_last')
</p>
@else
@elseif($order->errorCode !=0)
<p class="text-danger h1">@lang('content.order_fail_text',['message' => $order->errorMessage])
</p>
@else
<p class="text-danger h1">@lang('content.order_fail_text',['message' => $status_message])
</p>
@endif
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,44 @@
@extends('account')
@section('breadcrumb')
{{ Breadcrumbs::render('orders') }}
@endsection
@section('account_content')
<div class="for-padding">
<h2>@lang('content.bought')</h2>
<div class="platny-inner-tab">
<div class="tab-content">
<div class="row">
@if(!empty($orders))
<table class="table table-bordered">
<thead>
<tr>
<th>
{{__('Ady')}}
</th>
<th>{{__('Senesi')}}</th>
<th>{{__('Tölegi')}}</th>
<th>{{__('Statusy')}}</th>
</tr>
</thead>
<tbody>
@foreach($orders as $order)
<tr>
<td>{{$order->title}}</td>
<td>{{$order->created_at}}</td>
<td>{{$order->price}}</td>
<td><a href="{{route('order_status',$order->id)}}">{{$order->payed ? 'tölenen':'tölenmedik'}}</a></td>
</tr>
@endforeach
</tbody>
</table>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
{{ $orders->links() }}
</div>
@endif
</div>
</div>
</div>
</div>
@endsection

View File

@ -8,7 +8,7 @@
<div class="tab-content col-lg-9 col-md-9 col-sm-9 col-xs-12">
<div id="redak-tc" class="tab-pane fade active in" role="tabpanel">
<div class="for-padding">
<h2>@lang('content.searh_result',['key' => $key])</h2>
<h2>@lang('content.search_result',['key' => $key])</h2>
<div class="platny-inner-tab">
<ul role="tablist" >
<li class="@if($sort == 'new')active @endif">

View File

@ -68,12 +68,12 @@
<tbody>
@foreach($categories as $category)
<tr>
<td>{{$category->name}}</td>
<td>{{$category->category->name}}</td>
<td>{{$category->orders}}</td>
<td>{{$category->total}}</td>
<td>{{$category->views}}</td>
<td>{{$category->likes}}</td>
<td><a href="{{route('cat_stats',$category->id)}}">details</a> </td>
<td><a href="{{route('cat_stats',$category->category->id)}}">details</a> </td>
</tr>
@endforeach
</tbody>

View File

@ -30,6 +30,10 @@ Breadcrumbs::for('bought', function ($trail) {
$trail->parent('main');
$trail->push('Satyn alynanlar', route('bought'));
});
Breadcrumbs::for('orders', function ($trail) {
$trail->parent('main');
$trail->push('Sargytlar', route('orders'));
});
Breadcrumbs::for('watched', function ($trail) {
$trail->parent('main');
$trail->push('Seredilenler', route('watched'));
@ -38,7 +42,10 @@ Breadcrumbs::for('watched', function ($trail) {
Breadcrumbs::for('category', function ($trail, $category) {
//dd($category);
$trail->parent('main');
$trail->push($category->name, route('category', $category->id));
if($category)
$trail->push($category->name, route('category', $category->id));
else
$trail->push('Ählisi',route('home'));
});
Breadcrumbs::for('material', function ($trail, $material) {

View File

@ -37,15 +37,17 @@ Route::group(['prefix' => 'video'],function (){
Route::get('/search', 'HomeController@search')->name('search');
Route::get('/cat/{id}','HomeController@category')->name('category');
Route::get('/material/{id}','HomeController@material')->name('material');
Route::get('/material/{id}/download','HomeController@download')->name('download');
Route::get('/material/{id}/like','HomeController@like')->name('like');
Route::group(['middleware' => ['auth']], function () {
Route::get('/material/{id}/download','HomeController@download')->name('download');
Route::get('/material/{id}/like','HomeController@like')->name('like');
Route::get('/material/{id}/buy','OrderController@buy')->name('buy');
// Route::get('/dashboard', 'HomeController@dashboard')->name('dashboard');
Route::get('/profile', 'HomeController@profile')->name('profile');
Route::post('/profile', 'HomeController@profileUpdate')->name('profileUpdate');
Route::get('/bought', 'HomeController@bought_list')->name('bought');
Route::get('/orders', 'HomeController@orders_list')->name('orders');
Route::get('/favorite', 'HomeController@like_list')->name('liked');
Route::get('/watched', 'HomeController@watch_list')->name('watched');
Route::get('/order/{id}/status', 'OrderController@result')->name('order_status');