returned everything back

This commit is contained in:
ilmedova 2021-05-24 16:46:37 +05:00
parent a14665c460
commit 445a552f62
2 changed files with 14 additions and 25 deletions

View File

@ -7,7 +7,7 @@ use App\Models\Category;
use App\Models\Subscription;
use App\Models\User_sub;
use App\Models\UserMaterial;
use Illuminate\Support\Facades\DB;
use App\Models\Topheaderadv;
use App\Models\Material;
use App\Models\Order;
@ -31,12 +31,15 @@ class HomeController extends Controller
*/
public function index(){
$materials = DB::table('materials')->paginate(6);
$materials = Material::orderBy('created_at','desc')
->paginate(6);
$topheaderadvers = Topheaderadv::inRandomOrder()->get();
$topheaderadvs = $topheaderadvers[0];
$title = 'TurkmenTV';
$keywords = 'TurkmenTV';
$meta_description = 'TurkmenTV';
return view('main')->with([
'cat' => "",
'materials' => $materials,
@ -56,8 +59,8 @@ class HomeController extends Controller
$topheaderadvs = $topheaderadvers[0];
if($cat_id != 0){
$cat = Category::findOrFail($cat_id);
$materials = Material::paginate(6);
$cat = Category:: findOrFail($cat_id);
$materials = $cat->materials();
}
else{
@ -66,14 +69,16 @@ class HomeController extends Controller
}
switch ($sort){
case 'rate':
$materials = Material::orderBy('like','DESC')->paginate(6);
$materials->orderBy('like','DESC');
break;
case 'date':
$materials = Material::orderBy('created_at','ASC')->paginate(6);
$materials->orderBy('created_at','ASC');
break;
case 'all':
$materials = Material::orderBy('created_at','DESC')->paginate(6);
$materials->orderBy('created_at','DESC');
}
$materials = $materials->paginate(6);
//dd($materials);
return view('main')->with([
'cat' => $cat,
'materials' => $materials,

View File

@ -25,26 +25,10 @@
<div id="redak-tc-all" class="tab-pane fade active in container" role="tabpanel">
<div class="row">
@foreach($materials as $material)
<div class="col-lg-6 col-md-6 col-sm-6">
<a href="{{route('material',$material->id)}}">
<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->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')}}">
</div>
</a>
<div class="video-title">
<a href="">
<h4>{{$material->title}}</h4>
</a>
</div>
</div>
@include('partials.material_list_item')
@endforeach
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
{{ $materials->links() }}
{{ $materials->appends(['sort' => $sort])->links() }}
</div>
</div>
</div>