Larave List Data Get Show with Search box model
G:\laragon\www\LaravelProject\jioiptv.com\app\Http\Controllers\panel == UserController.php
====================================
use App\User;
use App\Models\PlanModel;
use App\Models\UserPlayListModel;
use App\Models\UserPlayListUrlModel;
use App\Models\ContactUsModel;
use Auth;
use Str;
use Hash;
public function playlist(Request $request)
{
$data['get_record'] = UserPlayListModel::getPlayList($request);
$data['getReseller'] = User::getReseller();
$data['getPlan'] = PlanModel::getPlan();
return view('panel.play.list',$data);
}
-------------------------
G:\laragon\www\LaravelProject\jioiptv.com\app - User .php
Model
static public function getReseller()
{
$customer = self::select('users.*')
->orderBy('id','desc')
->get();
return $customer;
}
G:\laragon\www\LaravelProject\jioiptv.com\app\Models == UserPlayListModel
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\User;
class UserPlayListModel extends Model
{
protected $table = 'user_playlist';
static public function get_single($id)
{
return self::find($id);
}
static public function getPlayList($request)
{
$return = self::select('user_playlist.*')
->orderBy('id','desc');
if(!empty($request->id))
{
$return = $return->where('id', '=', $request->id);
}
if ($request->uuid) {
$return = $return->where('uuid', 'like', '%' . $request->uuid . '%');
}
if ($request->email) {
$return = $return->where('email', 'like', '%' . $request->email . '%');
}
if ($request->user_id) {
$return = $return->where('user_id', '=', $request->user_id);
}
if ($request->plan_id) {
$return = $return->where('plan_id', '=', $request->plan_id);
}
if ($request->status) {
$status = $request->status;
if ($request->status == '1000') {
$status = '0';
}
$return = $return->where('user_playlist.status', '=', $status);
}
$return = $return->paginate(20);
return $return;
}
}
G:\laragon\www\LaravelProject\jioiptv.com\app\Models == PlanModel.php
====================
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PlanModel extends Model
{
protected $table = 'plan';
static public function get_single($id)
{
return self::find($id);
}
static public function getPlan()
{
return self::get();
}
}
======================
G:\laragon\www\LaravelProject\jioiptv.com\resources\views\panel\play == list.blade.php
View
@extends('panel.layouts.app')
@section('style')
<style type="text/css">
</style>
@endsection
@section('content')
<div role="main" class="m1f8ruid">
<div class="c16g3ykz">
<div class="hy6b0mh fm5uyt0 fm5uyt0--h-space-between">
<h1 class="hnrzc7i">Play List</h1>
<a class="add_project_link p1esicx4 b6pzbos b6pzbos--outlined b6pzbos--withIcon b6p1l88" href="{{ url('panel/playlist/add') }}">
<i class="fa fa-plus right-margin"></i> Add New Play List
</a>
</div>
{{-- Search Box Start --}}
<form action="" method="get" name="submitform">
<div class="b12wlhgq g1bxgbuw" style="--g1bxgbuw-3:repeat(6, 1fr);">
<div class="rrf1eel rrf1eel--small-gutter">
<label class="f1q5pk3">ID </label>
<input class="i1ixrrkg" name="id" placeholder="ID" type="text" value="{{ Request()->id }}">
</div>
<div class="rrf1eel rrf1eel--small-gutter">
<label class="f1q5pk3">UUID </label>
<input class="i1ixrrkg" name="uuid" placeholder="UUID" type="text" value="{{ Request()->uuid }}">
</div>
<div class="rrf1eel rrf1eel--small-gutter">
<label class="f1q5pk3">Reseller </label>
<select class="i1ixrrkg" name="user_id">
<option value="">Select Reseller</option>
@foreach ($getReseller as $element_r)
<option {{ ( $element_r->id == Request()->user_id) ? 'selected' : '' }} value="{{ $element_r->id }}">{{ $element_r->name }}</option>
@endforeach
</select>
</div>
<div class="rrf1eel rrf1eel--small-gutter">
<label class="f1q5pk3">Email </label>
<input class="i1ixrrkg" name="email" placeholder="Email" type="text" value="{{ Request()->email }}">
</div>
<div class="rrf1eel rrf1eel--small-gutter">
<label class="f1q5pk3">Plan </label>
<select class="i1ixrrkg" name="plan_id">
<option value="">Select Plan</option>
@foreach ($getPlan as $element)
<option {{ ( $element->id == Request()->plan_id) ? 'selected' : '' }} value="{{ $element->id }}">{{ $element->name }}</option>
@endforeach
</select>
</div>
<div class="rrf1eel rrf1eel--small-gutter">
<label class="f1q5pk3">Status </label>
<select class="i1ixrrkg ChangeGroup" name="status" >
<option value="">Select Status</option>
<option {{ (Request()->status == '1')?'selected':'' }} value="1">Active</option>
<option {{ (Request()->status == '1000')?'selected':'' }} value="1000">Inactive</option>
</select>
</div>
</div>
<button class="b6pzbos" type="submit">Submit</button>
<a class="b6pzbos btn-danger-color" href="{{ url('panel/playlist') }}" >Reset</a>
</form>
<br>
{{-- Search Box End --}}
<div class="companies_list">
<table class="table">
<tr>
<th>ID</th>
<th>Reseller</th>
<th>UUID</th>
<th>Plan</th>
<th>Email</th>
<th>Date</th>
<th>Status</th>
<th>URL</th>
<th>Created Date</th>
<th>Action</th>
</tr>
@forelse($get_record as $value)
<tr>
<td>{{ $value->id }}</td>
<td>
<select class="i1ixrrkg changeReseller" id="{{ $value->id }}" style="width: 150px;">
<option value="">Select Reseller</option>
@foreach($getReseller as $reseller)
<option {{ ($reseller->id == $value->user_id) ? 'selected' : '' }} value="{{ $reseller->id }}">{{ $reseller->name }}</option>
@endforeach
</select>
</td>
<td>{{ $value->uuid }}</td>
<td>{{ !empty($value->plan) ? $value->plan->name : '' }}</td>
<td>{{ $value->email }}</td>
<td>
{{ !empty($value->start_date) ? date('d-m-Y',strtotime($value->start_date)) : '' }} to {{ !empty($value->expire_date) ? date('d-m-Y',strtotime($value->expire_date)) : '' }}
</td>
<td>{{ !empty($value->status) ? 'Active' : 'Inactive' }}</td>
<td>
@foreach($value->get_playlist_url as $value_url)
{{ $value_url->url }}
<hr>
@endforeach
</td>
<td>
{{ !empty($value->created_at) ? date('d-m-Y H:i A',strtotime($value->created_at)) : '' }}
</td>
<td>
<a href="{{ url('panel/playlist/view/'.$value->id) }}" class="edit-delete-icon" title="View" type="button"><i class="fa fa-eye"></i></a>
<a href="{{ url('panel/playlist/edit/'.$value->id) }}" class="edit-delete-icon" title="Edit" type="button"><i class="fa fa-pencil"></i></a>
<a href="{{ url('panel/playlist/delete/'.$value->id) }}" class="edit-delete-icon" title="Edit" type="button" onclick="return confirm('Are you sure you want to delete this option item?')"><i class="fa fa-trash"></i></a>
</td>
</tr>
@empty
<tr>
<td colspan="100%">No Playlist found.</td>
</tr>
@endforelse
</table>
{!! $get_record->appends(request()->query())->links() !!}
</div>
</div>
</div>
@endsection
@section('script')
<script type="text/javascript">
$(document).ready(function() {
$('.ChangeGroup').on('change', function() {
document.forms['submitform'].submit();
});
});
$('.changeReseller').change(function(){
var user_id = $(this).val();
var re_user_id = $(this).attr('id');
$.ajax({
type:'GET',
url:"{{url('panel/playlist/changeReseller')}}",
data: {user_id: user_id,re_user_id:re_user_id},
dataType: 'JSON',
success:function(data){
alert('Status successfully changed.');
}
});
});
</script>
@endsection
=======
Comments
Post a Comment