AbdulBazith

Experience

1,590

0 Best Reply Awards

  • Member Since 1 Month Ago
  • 0 Lessons Completed
  • 0 Favorites

21st June, 2018

AbdulBazith left a reply on How To Pass Multiple Values Through Ajax In Laravel? • 1 day ago

Sorry sorry @Snapey and sorry guys.

AbdulBazith left a reply on How To Pass Multiple Values Through Ajax In Laravel? • 2 days ago

@Cronix @Snapey @mvd

kindly help me for this pagination problem also please

AbdulBazith started a new conversation How To Open A Specific Page When Laravel Project Loads? • 2 days ago

Guys I am working with a project ‘milkfarm’. When I open my browser and type Localhost:8000 my welcome.blade.php file is loaded first in the browser. What I need is to open a specific page which I wish.

How to achieve this? Kindly help me please

19th June, 2018

AbdulBazith left a reply on How To Use User Defined Authentication In Laravel? • 3 days ago

@Yorki @Thyrosis @grenadecx

Thank you so much guys. Let me try this and soonly i will reply you thankz guys

AbdulBazith left a reply on How To Pass Multiple Values Through Ajax In Laravel? • 3 days ago

Wow @Cronix thanks a lot well worked thank you soo much

another small doubt in this itself pagination problm,

this is my controller,

public function index()
    {
        $sales = Sales_details::orderBy('created_at','desc')-   >paginate(5);

        return view('Sales_details.view')->withsales($sales);
    }


When i click view menu the index function is called and the below given view.blade file will run. there i displayed all the data in tabular format with pagination(5)

here is my view. blade below


@extends('main')

@section('title','| All data Sales')

@section('content')

<div class="row">
<div class="col-md-12">        

   <table  id="sales_details" class="table table-bordered">

   <thead>

            <th > {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_sid','name'=>'search_sid')) }}</th>
            <th> {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_date','name'=>'search_date')) }}</th>
            <th> {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_time','name'=>'search_time')) }}</th>
            <th> {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_id','name'=>'search_id')) }}</th>
            <th> {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_type','name'=>'search_type')) }}</th>
            <th> {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_name','name'=>'search_name')) }}</th>
            <th> {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_area','name'=>'search_area')) }}</th>
            <th> {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_booth','name'=>'search_booth')) }}</th>
            <th> {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_rl','name'=>'search_rl')) }}</th>
            <th> {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_nl','name'=>'search_nl')) }}</th>
            <th> {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_total','name'=>'search_total')) }}</th>
            <th> {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_note','name'=>'search_note')) }}</th>
            <th> <a href="" class="btn btn-success btn-sm" style="width: 100%;">Search</a></th>

    </thead>


      <thead>

              <th >Sales Id</th>
              <th>Date</th>
              <th>Time</th>
              <th>Customer Id</th>
              <th>Customer Type</th>
              <th>Customer Name</th>
              <th>Customer Area</th>
              <th>Customer Booth</th>
              <th>Rate/Litre</th>
              <th>No of Litres</th>
              <th>Total</th>
              <th>Note</th>
              <th>Action</th>

      </thead>

      <tbody>
            @foreach($sales as $sal)
                <tr>
                    {{-- <th>{{ $ven->id }}</th> --}}
                    <td>{{ $sal->sales_id }}</td>
                    <td>{{ $sal->date }}</td>
                    <td>{{ $sal->time }}</td>
                    <td>{{ $sal->customer_id }}</td>
                    <td>{{ $sal->customer_type }}</td>
                    <td>{{ $sal->customer_name }}</td>
                    <td>{{ $sal->customer_area }}</td>
                    <td>{{ $sal->customer_booth }}</td>
                    <td>{{ $sal->rate_per_litre }}</td>
                    <td>{{ $sal->no_of_litre }}</td>
                    <td>{{ $sal->total }}</td>
                    <td>{{ $sal->note }}</td>

    <td>
        <a href="{{ route('Sales_details.show',$sal->id) }}" class="btn btn-success btn-sm" style="width: 100%;">View</a>

    </td>
    
  
             {!! Form::close() !!}  
       </tr>
            @endforeach
      </tbody>
      </table>
            <div class="text-center"> 
    {!! $sales->Links(); !!} 
            </div>
</div>
</div>
<script type="text/javascript">

    $('#search_sid,#search_date,#search_time,#search_id,#search_type,#search_name,#search_area,#search_booth,#search_rl,#search_nl,#search_total,#search_note').on('keyup',function(){

    $.ajax({

    type : 'get',

    url : '{{URL::to('search_name')}}',

    data:{ 'search_sid': $('#search_sid').val(),
           'search_date': $('#search_date').val(),
           'search_time': $('#search_time').val(),
           'search_id': $('#search_id').val(),
            'search_type': $('#search_type').val(),
            'search_name': $('#search_name').val(),
            'search_area': $('#search_area').val(),
            'search_booth': $('#search_booth').val(),
            'search_rl': $('#search_rl').val(),
            'search_nl': $('#search_nl').val(),
            'search_total': $('#search_total').val(),
            'search_note': $('#search_note').val()

    },
    success:function(data){

     $('tbody').html(data);

    }

    });

    })
    </script>
@endsection

When onkeyup event occurs in text box then the search_name function in my controller is called..

This is my search_name function in controller


public function search_name( Request $request )

    {
                    $output="";
                    $sales = Sales_details::where(function ($query) use ($request)
                       {

                         // Sales id.
                         if (!empty($request->search_sid)) {
                            $query->Where('sales_id', 'LIKE', '%' . $request->search_sid . '%');
                          }

                           // date.
                        if (!empty($request->search_date)) {
                            $query->Where('date', 'LIKE', '%' . $request->search_date . '%');
                          }

                           // time.
                        if (!empty($request->search_time)) {
                            $query->Where('time', 'LIKE', '%' . $request->search_time . '%');
                          }

                           // customer id.
                        if (!empty($request->search_id)) {
                            $query->Where('customer_id', 'LIKE', '%' . $request->search_id . '%');
                          }

                           // type.
                        if (!empty($request->search_type)) {
                            $query->Where('customer_type', 'LIKE', '%' . $request->search_type . '%');
                          }

                        // Name.
                        if (!empty($request->search_name)) {
                          $query->Where('customer_name', 'LIKE', '%' . $request->search_name . '%');
                        }

                        // Area.
                        if (!empty($request->search_area)) {
                          $query->Where('customer_area', 'LIKE', '%' . $request->search_area . '%');
                        }

                       // Booth.
                        if (!empty($request->search_booth)) {
                          $query->orWhere('customer_booth', 'LIKE', '%' . $request->search_booth . '%');
                        }

                        // rate per litre.
                        if (!empty($request->search_rl)) {
                            $query->Where('rate_per_litre', 'LIKE', '%' . $request->search_rl . '%');
                          }

                         // No of litres.
                         if (!empty($request->search_nl)) {
                            $query->Where('no_of_litre', 'LIKE', '%' . $request->search_nl . '%');
                          }

                           // total.
                        if (!empty($request->search_total)) {
                            $query->Where('total', 'LIKE', '%' . $request->search_total . '%');
                          }

                           // note.
                        if (!empty($request->search_note)) {
                            $query->Where('note', 'LIKE', '%' . $request->search_note . '%');
                          }

                    })->get();

                     if($sales)

                    {

                    foreach ($sales as $key => $sale)
                    {

                    $output.='<tr>'.

                    '<td>'.$sale->sales_id.'</td>'.

                    '<td>'.$sale->date.'</td>'.

                    '<td>'.$sale->time.'</td>'.

                    '<td>'.$sale->customer_id.'</td>'.

                    '<td>'.$sale->customer_type.'</td>'.

                    '<td>'.$sale->customer_name.'</td>'.

                    '<td>'.$sale->customer_area.'</td>'.

                    '<td>'.$sale->customer_booth.'</td>'.

                    '<td>'.$sale->rate_per_litre.'</td>'.

                    '<td>'.$sale->no_of_litre.'</td>'.

                    '<td>'.$sale->total.'</td>'.

                    '<td>'.$sale->note.'</td>'.

                    '<td>'

                    ."<a href='' class='btn btn-success btn-sm' style='width: 100%;'>View</a>".

                    '</td>'.

                    '</tr>';

                    }               

                    return Response($output);
                    }
    }

now based on my where query the results are filtered so here i need to give pagination what should i do??

if i give pagination(2) in this below line, it doesnt work why?


$sales = Sales_details::where(function ($query) use ($request) {
//those if condition with where clause
 })->Paginate(2);

AbdulBazith left a reply on How To Pass Multiple Values Through Ajax In Laravel? • 3 days ago

@mvd and @Cronix both of you thank you sooo much

$sales = Sales_details::where(function ($query) use ($request) {

This works exactly thank you ...

There is another small doubt regarding this,,

in my view.blade the below code, Iam having three text boxes for search i need to call javascript function for all the three text boxes in onkeyup event. how it is possible



<thead>

            <th > {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_name','name'=>'search_name')) }}</th>
            <th> {{ Form::text('search_area',null,array('class'=>'form-control','id'=>'search_area','name'=>'search_area')) }}</th>
            <th> {{ Form::text('search_booth',null,array('class'=>'form-control','id'=>'search_booth','name'=>'search_booth')) }}</th>

</thead>


this is my javascript



<javascript>

$('#search_name').on('keyup',function(){

$value1=$('#search_name').val();
$value2=$('#search_area').val();
$value3=$('#search_booth').val();
    
$.ajax({

type : 'get',

url : '{{URL::to('search_name')}}',

data:{'search_name':$value1
    'search_name':$value2
'search_name':$value3

},

success:function(data){

 $('tbody').html(data);

}

});

})

</script>

When my first first text box is in onkeyup event then the search_name function in javascript must be called that is

$('#search_name').on('keyup',function(){

the above javascript..

here search_name is my class name of name textbox.

But what i expect is whatever my textbox is onkeyup event

then,


$value1=$('#search_name').val();
$value2=$('#search_area').val();
$value3=$('#search_booth').val();
    
$.ajax({

type : 'get',

url : '{{URL::to('search_name')}}',

data:{'search_name':$value1
    'search_name':$value2
'search_name':$value3

},

success:function(data){

 $('tbody').html(data);

}

});

})

this must be called how??

AbdulBazith started a new conversation How To Use User Defined Authentication In Laravel? • 3 days ago

I currently working with authentication in my project ”milkfarm”. I am using Laravel 5.6.2 version. My doubt is Laravel already have four controllers for authentication

LoginController RegisterController ForgotPasswordController ResetPasswordController

Now I have to make an authentication in my application. But if I use existing authentication controllers it uses email id and password for login. But my requirement is to use name or mobile number and password for my login.

What changes I should do in my controllers, route files and database to use some other username or phone number to login my account no using email id.

Kindly anyone help

AbdulBazith left a reply on How To Pass Multiple Values Through Ajax In Laravel? • 4 days ago

@mvd sorry 3 days iam on leave iam unable to try ur code..

if i use this below code it shows error

$sales = Sales_details::where(function ($query) use ($request->search_name, $request->search_area, $request->search_booth) {

syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ',' or ')'

whats wrong in this??

another doubt my function has just one variable $request

the how it can get three values

see

public function search_name( Request $request )

14th June, 2018

AbdulBazith left a reply on How To Pass Multiple Values Through Ajax In Laravel? • 1 week ago

@mvd i will try this, but here where is my function name and what the $query indicates?

AbdulBazith left a reply on Pagination Problem In Search Option In Laravel • 1 week ago

@BezhanSalleh thank you, wait i will try and reply

AbdulBazith started a new conversation How To Pass Multiple Values Through Ajax In Laravel? • 1 week ago

I am having form view.blade which shows the data of all sales_details (my table) in tabular format.

I am having three text boxes in my view.blade which I am using for search option.

This is my view.blade (just I copied the search box code only)


 <thead>

            <th > {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_name','name'=>'search_name')) }}</th>
            <th> {{ Form::text('search_area',null,array('class'=>'form-control','id'=>'search_area','name'=>'search_area')) }}</th>
            <th> {{ Form::text('search_booth',null,array('class'=>'form-control','id'=>'search_booth','name'=>'search_booth')) }}</th>

</thead>

This is my JavaScript


<javascript>

$('#search_name').on('keyup',function(){

$value1=$('#search_name').val();
$value2=$('#search_area').val();
$value3=$('#search_booth').val();
    
$.ajax({

type : 'get',

url : '{{URL::to('search_name')}}',

data:{'search_name':$value1
    'search_name':$value2
'search_name':$value3

},

success:function(data){

 $('tbody').html(data);

}

});

})

</script>

This is my controller


public function search_name( Request $request )

{
                    $output="";

                    $sales=Sales_details::where('customer_name','LIKE','%'.$request->search_name.'%')                  
                    ->orWhere('customer_area','LIKE','%'.$request->search_name.'%')
                    ->orWhere('customer_booth','LIKE','%'.$request->search_name.'%')
                   
                    ->paginate(10);
    
    if($sales)

    { 
        //Need to return the output to the ajax
    }
    else
    {
        // Need to perform some thing
    }
}

My doubt is I am writing the JavaScript in onkeyup event for the textboxes. I have entered some text in first text box and some text in second textbox an when I enter content in third textbox the ajax should fetch all the three content from three text boxes and it should pass to the function search() in the controller. [Will be better if any of the textbox is gets the onkeyup event the same ajax function must be called how?]

Then another doubt is after passing the three content those three must be used to where conditions in the function.

13th June, 2018

AbdulBazith left a reply on Pagination Problem In Search Option In Laravel • 1 week ago

@pardeepkumar it not working.. after filter also the old pagination is displayed. before filter my records are more then 50 so i displayed just 5 per page that is paginate(5) so it took 10 pages.

But after filter my record will be just 6 or 7. i have given paginate(10). so here it must be in only one page with 7 records.

but it shows 10 pages i think after filter the pagination not working

AbdulBazith left a reply on How To Perform Multiple Searches In Laravel? • 1 week ago

@pardeepkumar thank you, but what about java script and view page?

i need to pass the values to controller through ajax. I need to pass mutiple values some time that is,

name="Abdul" city="India" date="5-5-2018"

these three are typed by user during the view page that is when all data is viewed the user types the required filter through the text box . All the three values are passed through ajax to the search function the it returns appropriate result

i think you understood my question?

AbdulBazith started a new conversation Pagination Problem In Search Option In Laravel • 1 week ago

I am having a textbox which searches the data and displays in tabular format. The search box works when I type any text it in that is it works in “Onkeyup” event written in Ajax .

When the view page loads all the data are displayed to the user. I have given pagination for the view.

When the user type any name in the search box it goes to the function in controller by Ajax call and searches for the result and then displays only the matched values to the user. But the pagination remains same as for the first view. If I change the page number then the page is refreshed. How to solve this?

This is my controller Sales_detailsController


public function index()
    {
        $sales = Sales_details::orderBy('created_at','desc')->paginate(5);

        return view('Sales_details.view')->withsales($sales);
    }


This is my view. Blade


{{-- @extends('main')
@section('title','| View')

@section('content')


<h1>{{ $vendor->vendor_id }}</h1>
<h1>{{ $vendor->vendor_name }}</h1>
<p>this is my details</p>


@endsection --}}

@extends('main')

@section('title','| All data Sales')

@section('content')

<div class="row">
        <div class="col-md-10">


        </div>
     <div class="col-md-2">
            <a href="{{ route('Sales_details.create') }}" class="btn btn-lg btn-block btn-primary btn-h1-spacing"> Sales Entry</a>
     </div>
<hr>
</div><!-- end of row-->

<div class="row">
<div class="col-md-12">

        <caption><h2 align="center">SALES ENTRY PREVIEW</h2></caption>


{{ Form::text('search_a',null ,array('class'=>'form-control','id'=>'search_a','name'=>'search_a')) }}<br>

    <table  id="sales_details" class="table table-bordered">
      
      <thead>

              <th >Sales Id</th>
              <th>Date</th>
              <th>Time</th>
              <th>Customer Id</th>
              <th>Customer Type</th>
              <th>Customer Name</th>
              <th>Customer Area</th>
              <th>Customer Booth</th>
              <th>Rate/Litre</th>
              <th>No of Litres</th>
              <th>Total</th>
              <th>Note</th>
              <th>Action</th>

      </thead>

      <tbody>
            @foreach($sales as $sal)
                <tr>
                    {{-- <th>{{ $ven->id }}</th> --}}
                    <td>{{ $sal->sales_id }}</td>
                    <td>{{ $sal->date }}</td>
                    <td>{{ $sal->time }}</td>
                    <td>{{ $sal->customer_id }}</td>
                    <td>{{ $sal->customer_type }}</td>
                    <td>{{ $sal->customer_name }}</td>
                    <td>{{ $sal->customer_area }}</td>
                    <td>{{ $sal->customer_booth }}</td>
                    <td>{{ $sal->rate_per_litre }}</td>
                    <td>{{ $sal->no_of_litre }}</td>
                    <td>{{ $sal->total }}</td>
                    <td>{{ $sal->note }}</td>

    <td>
        <a href="{{ route('Sales_details.show',$sal->id) }}" class="btn btn-success btn-sm" style="width: 100%;">View</a>

    </td>  
           
                </tr>
            @endforeach
      </tbody>
      </table>

            <div class="text-center">             

                {!! $sales->Links(); !!} 
            </div>

</div>
</div>
<script type="text/javascript"> 

$('#search_a').on('keyup',function(){

$value=$(this).val();

$.ajax({

type : 'get',

url : '{{URL::to('search_name')}}',

data:{'search_name':$value

},

success:function(data){

 $('tbody').html(data);

}

});


})

    </script>

@endsection


This is my java script


<script type="text/javascript"> 

$('#search_a').on('keyup',function(){

$value=$(this).val();

$.ajax({

type : 'get',

url : '{{URL::to('search')}}',

data:{'search_name':$value

},

success:function(data){

 $('tbody').html(data);

}

});


})

    </script>


This is my controller for search the function search()


public function search( Request $request )

    {

                    $output="";

                    $sales=Sales_details::
                      where('sales_id','LIKE','%'.$request->search_name.'%')
                      ->orwhere('date','LIKE','%'.$request->search_name.'%')
                      ->orwhere('time','LIKE','%'.$request->search_name.'%')
                      ->orwhere('customer_id','LIKE','%'.$request->search_name.'%')
                    ->orwhere('customer_name','LIKE','%'.$request->search_name.'%')
                    ->orwhere('customer_type','LIKE','%'.$request->search_name.'%')
                    ->orWhere('customer_area','LIKE','%'.$request->search_name.'%')
                    ->orWhere('customer_booth','LIKE','%'.$request->search_name.'%')
                    ->orWhere('no_of_litre','LIKE','%'.$request->search_name.'%')
                    ->orWhere('rate_per_litre','LIKE','%'.$request->search_name.'%')
                    ->orWhere('total','LIKE','%'.$request->search_name.'%')
                    ->orWhere('note','LIKE','%'.$request->search_name.'%')
                    ->paginate(10);

                     if($sales)

                    {

                    foreach ($sales as $key => $sale)
                    {

                    $output.='<tr>'.

                    '<td>'.$sale->sales_id.'</td>'.

                    '<td>'.$sale->date.'</td>'.

                    '<td>'.$sale->time.'</td>'.

                    '<td>'.$sale->customer_id.'</td>'.

                    '<td>'.$sale->customer_type.'</td>'.

                    '<td>'.$sale->customer_name.'</td>'.

                    '<td>'.$sale->customer_area.'</td>'.

                    '<td>'.$sale->customer_booth.'</td>'.

                    '<td>'.$sale->no_of_litre.'</td>'.

                    '<td>'.$sale->rate_per_litre.'</td>'.

                    '<td>'.$sale->total.'</td>'.

                    '<td>'.$sale->note.'</td>'.

                    '<td>'

                    ."<a href='' class='btn btn-success btn-sm' style='width: 100%;'>View</a>".

                    '</td>'.

                    '</tr>';

                    }

                    return Response($output);
                    }

    }


When page load the pagination is ok. but after search the pagination is not changing. the old pagination is displayed and if i change the page after search once again it reloads the page so that my searched keyword disappears.

How to solve this??

AbdulBazith left a reply on How To Perform Multiple Searches In Laravel? • 1 week ago

@mushood Thank you .. but i can't understand the coding which is given first.. can you explain or can you send me an appropriate link to make my work easier. vue i don't need now please

12th June, 2018

AbdulBazith started a new conversation How To Perform Multiple Searches In Laravel? • 1 week ago

Guys I already asked about multiple searches in laravel. I have tried with some coding. Let me paste those and kindly help how to move further .

My table name is sales_details with fields(sales_id, date, time, customer_id, customer_name, customer_type, customer_area, customer_booth, no_of_litre, rate_per_litre, total, note).

This is my controller for view

public function index()
    {
        $sales = Sales_details::orderBy('created_at','desc')->paginate(5);

        return view('Sales_details.view')->withsales($sales);
    }

This is my view. Blade

@extends('main')

@section('title','| All data Sales')

@section('content')

<div class="row">
        <div class="col-md-10">


        </div>
     <div class="col-md-2">
            <a href="{{ route('Sales_details.create') }}" class="btn btn-lg btn-block btn-primary btn-h1-spacing"> Sales Entry</a>
     </div>
<hr>
</div><!-- end of row-->

<div class="row">
<div class="col-md-12">

        <caption><h2 align="center">SALES DETAILS PREVIEW</h2></caption>

    <table  id="sales_details" class="table table-bordered">
        <thead>

                    <th > {{ Form::text('search_sid',null,array('class'=>'form-     control','id'=>'search_sid','name'=>'search_sid')) }}</th>

            <th> {{ Form::text('search_date',null,array('class'=>'form-control','id'=>'search_date','name'=>'search_date')) }}</th>

            <th> {{ Form::text('search_time',null,array('class'=>'form-control','id'=>'search_time','name'=>'search_time')) }}</th>

            <th> {{ Form::text('search_id',null,array('class'=>'form-control','id'=>'search_id','name'=>'search_id')) }}</th>

            <th> {{ Form::text('search_type',null,array('class'=>'form-control','id'=>'search_type','name'=>'search_type')) }}</th>

            <th> {{ Form::text('search_name',null,array('class'=>'form-control','id'=>'search_name','name'=>'search_name')) }}</th>

            <th> {{ Form::text('search_area',null,array('class'=>'form-control','id'=>'search_area','name'=>'search_area')) }}</th>

            <th> {{ Form::text('search_booth',null,array('class'=>'form-control','id'=>'search_booth','name'=>'search_booth')) }}</th>

            <th> {{ Form::text('search_rate_per_lit',null,array('class'=>'form-control','id'=>'search_rate_per_lit','name'=>'search_rate_per_lit')) }}</th>

            <th> {{ Form::text('search_no_of_lit',null,array('class'=>'form-control','id'=>'search_no_of_lit','name'=>'search_no_of_lit')) }}</th>

            <th> {{ Form::text('search_total',null,array('class'=>'form-control','id'=>'search_total','name'=>'search_total')) }}</th>

            <th> {{ Form::text('search_note',null,array('class'=>'form-control','id'=>'search_note','name'=>'search_note')) }}</th>

    </thead>

      <thead>

              <th >Sales Id</th>

              <th>Date</th>

              <th>Time</th>

              <th>Customer Id</th>

              <th>Customer Type</th>

              <th>Customer Name</th>

              <th>Customer Area</th>

              <th>Customer Booth</th>

              <th>Rate/Litre</th>

              <th>No of Litres</th>

              <th>Total</th>

              <th>Note</th>

              <th>Action</th>

      </thead>

      <tbody >
            @foreach($sales as $sal)
                <tr>
            
     <td>{{ $sal->sales_id }}</td>

                    <td>{{ $sal->date }}</td>

                    <td>{{ $sal->time }}</td>

                    <td>{{ $sal->customer_id }}</td>

                    <td>{{ $sal->customer_type }}</td>

                    <td>{{ $sal->customer_name }}</td>

                    <td>{{ $sal->customer_area }}</td>

                    <td>{{ $sal->customer_booth }}</td>

                    <td>{{ $sal->rate_per_litre }}</td>

                    <td>{{ $sal->no_of_litre }}</td>

                    <td>{{ $sal->total }}</td>

                    <td>{{ $sal->note }}</td>

    <td>
        <a href="{{ route('Sales_details.show',$sal->id) }}" class="btn btn-success btn-sm" style="width: 100%;"</td>View</a>
 </tr>
            @endforeach
      </tbody>
      </table>

            <div class="text-center">

                {!! $sales->Links(); !!}
            </div>


</div>
</div>
<script type="text/javascript">

    $('#search_name').on('keyup',function(){

    $value=$(this).val();

    $.ajax({

    type : 'get',

    url : '{{URL::to('search_name')}}',

    data:{'search_name':$value},

    success:function(data){
        if(data)
                                {
                                    var result=data;
                                    console.log(result);
                                    

                            } 
    }

    });

    })

    </script>

@endsection

In the view. Blade I have displayed the data in tabular format. And I also have empty text box in each field in the view. Blade files for search purpose. My objective is if I search in name text box it must filter from DB and it should return the values to view. Blade file.

After searching name it displays 2 or 3 rows based on my search say for example I am searching for customer name “Abdul” then I returns 4 rows with different id, date, time,area,booth.

Next I need to search based on date in the returned 4 rows. Say for example if I give a specific date it must be further filtered from the returned 4 rows. The it will return 2 rows then I need to further sort.

Here is my JavaScript code written in the view. Blade page

<script type="text/javascript">

    $('#search_name').on('keyup',function(){

    $value=$(this).val();

    $.ajax({

    type : 'get',

    url : '{{URL::to('search_name')}}',

    data:{'search_name':$value},

    success:function(data){
        if(data)
                                {
                                    var result=data;
                                    console.log(result);
                                    
                            } 
    }

    });

    })

    </script>

And here is my search_name function in controller


 public function search_name(Request $request)

    {
        if($request->ajax())

    {               

                    $sales=Sales_details::where('customer_name','LIKE','%'.$request->search_name.'%')->first();

    return Response($sales);
   }

   }

Now everything is ok. But after returning the return $sales with sorted item. It comes to the view. Blade. But I don’t know how to receive the $sales in view. Blade and display in the < tbody> in for loop in jquery.

Another doubt is if it is possible to display the sorted items in the then my next problem is after that how can I sort further with date or time or id and perform the same task.

Simple to say multiple search option in the view form with multiple 'and' conditions must be searched in live by the user

Anyone Please help me to complete this searching function

AbdulBazith left a reply on How To Create A New Function In Resource Controller In Laravel? • 1 week ago

@tomopongrac @Snapey Thank you soo much guys.. it worked for me. thank youuu..

@Snapey one doubt while posting questions in laracast sometimes my code gets not formatted in black screen why ?

AbdulBazith left a reply on How To Add Column’s Values In Laravel? • 1 week ago

@Snapey I am already using this but it is just displaying in the page. I need alert msg ..

11th June, 2018

AbdulBazith left a reply on How To Use Search Box In Laravel? • 1 week ago

@zion i displayed my table in a form as below,

CUSTOMER DETAILS PREVIEW

{{-- # --}} Customer Id Name Type Location Area Booth phno Rate/Litre Address Note {{-- created at --}} Action
  </thead>

  <tbody>
        @foreach($cus as $cuss)
            <tr>
                {{-- <th>{{ $ven->id }}</th> --}}
                <td>{{ $cuss->customer_id }}</td>
                <td>{{ $cuss->customer_type }}</td>
                <td>{{ $cuss->customer_name }}</td>
                <td>{{ $cuss->cus_loc }}</td>
                <td>{{ $cuss->cus_area }}</td>
                <td>{{ $cuss->cus_booth }}</td>
                <td>{{ $cuss->customer_phno }}</td>
                <td>{{ $cuss->rate_per_litre }}</td>
                <td>{{ $cuss->customer_address }}</td>
                <td>{{ $cuss->note }}</td>
               {{--  <td>{{ $ven->created_at }}</td> --}}
<td> 

For each column i have a text box to filter them.

whats my next step?? if i enter customer_name in search box it must filter in the form display..

AbdulBazith left a reply on How To Create A New Function In Resource Controller In Laravel? • 1 week ago

In the navbar I am having

PURCHASE DETAILS

But still it shows error

"Route [Purchase_details.open] not defined."

AbdulBazith left a reply on How To Create A New Function In Resource Controller In Laravel? • 1 week ago

@tomopongrac "No it shows Route not defined" error

AbdulBazith left a reply on How To Use Search Box In Laravel? • 1 week ago

I heard that but i didn't use that because that data-table only provides a single search box with one filter.

What i need is i must filter with name and city that is i need and operation multiple filter with multiple conditions.

I think you understood my question.

AbdulBazith started a new conversation How To Create A New Function In Resource Controller In Laravel? • 1 week ago

I am having a resource controller Purchase_detailsContoller. My doubt is how can I create a new function in this controller other then default functions (create, index, edit, store, show, and destroy).

Here is my config route file ,

Route::resource('Purchase_details','Purchase_detailsController');

What should I do to add a new function in Purchase_detailsContoller. In route file what should I do?

Say for example if I need to add a function public open(). Then what should I do?

9th June, 2018

AbdulBazith started a new conversation How To Use Search Box In Laravel? • 1 week ago

I am displaying a table (customer_details) in form in tabulation structure. The fields are (customer_id, customer_name, customer_address, customer_city, customer_phno).

All these are displayed in tabulation structure in my form to the user. My doubt is I need a multiple search box to filter the customer_details based on customer_id, or customer_name or customer_address or customer_city, or customer_phno.

How to do this? Is there any appropriate video please share the link.

AbdulBazith left a reply on How To Add Column’s Values In Laravel? • 1 week ago

@Snapey

Thank you so much your answers are really great.!! In the else part if date not match an alert message must be displayed. how can I write alert message in controller??

8th June, 2018

AbdulBazith left a reply on How To Add Column’s Values In Laravel? • 2 weeks ago

@mvd sorry i didn't try because @Snapey's answer is useful for me .

AbdulBazith left a reply on How To Add Column’s Values In Laravel? • 2 weeks ago

@Grado thanks for your suggestion but @Snapey 's answer is very useful for me because it reduces lots of coding for me. but my doubt is if the date mismatch it should not perform anythin. but here it showing error "Trying to get property 'total_milk' of non-object"

I need to get rid of this error how @Snapey @Grado ??

AbdulBazith left a reply on How To Add Column’s Values In Laravel? • 2 weeks ago

@Snapey ya thank you snapey it is working same as my update.

but it throws an error "Trying to get property 'total_milk' of non-object" if the date mismatch why??

my objective is if dates are equal then it should update else no need of any change.. how is it possible??

AbdulBazith left a reply on How To Add Column’s Values In Laravel? • 2 weeks ago

@snapey one doubt

$stock = Overallstock::where('date',$date)->first();

what this query will return?

AbdulBazith left a reply on How To Add Column’s Values In Laravel? • 2 weeks ago

I tried this coding but shows error

$no=20;

Overallstock::where('date', $date)->update(['balance_milk' => DB::raw('total_milk' - $no)]);

Here Overall is my model, balance_milk and total_milk is my field.

The error it shows is "A non-numeric value encountered" indicating the query.

actually what i expect is it checks the date and if the date are same then value from 'total_milk' field gets subtracted with $no(20) and will be updated in the 'balance_milk' field.

I think the error is here :raw('total_milk' - $no)]);

but i do not know exactly. can anyone help

7th June, 2018

AbdulBazith started a new conversation How To Add Column’s Values In Laravel? • 2 weeks ago

I am having a table 'stock' with field names (date, quantity, sold, balance). I will enter the stock details through a form. My doubt is when I enter quantity and the date is same means it should be added with the existing quantity it should not become a new row. How to perform this? Kindly help please

5th June, 2018

AbdulBazith left a reply on How To Return 0 Or Any Value When There Is No Records In Table Laravel? • 2 weeks ago

@Cronix thank you it worked thank youuu soooo much

4th June, 2018

AbdulBazith left a reply on How To Display Value To Tex Tbox Returned From Jquery In Laravel? • 2 weeks ago

Hey it worked i used the below code in my jquery

if(data) { var result=data; console.log(result);

                                 $("#vendor_area").val(result.ven_area);
                                 $("#vendor_booth").val(result.ven_booth);
                                 $("#rate_per_litre").val(result.rate_per_litre);
                                 $("#vendor_id").val(result.vendor_id);
                        }

and the below code in my controller

$data = Vendor_details::select('ven_area','ven_booth','vendor_id','rate_per_litre')->where('vendor_name',$request->vendor_name)->first();

return response()->json($data);

AbdulBazith started a new conversation How To Return 0 Or Any Value When There Is No Records In Table Laravel? • 2 weeks ago

Guys I am having a table which has no records. I am trying the bellow command

$idd=Purchase_details:: select('id')->orderBy('created_at','desc')->first()->id;

Then it returning an error “Trying to get property 'id' of non-object” But what I expect is if there is no record then it should return 0 or something. I tried this code

if($idd==null) { $iidadd='01'; }

But no use the same error “Trying to get property 'id' of non-object”

AbdulBazith left a reply on How To Display Value To Tex Tbox Returned From Jquery In Laravel? • 2 weeks ago

There is another doubt for me. If first text box value is given then the second text box filled by fetching from db. But what i need is if first text box is given then remaining 4 text boxes must be filled by fetching from db how possible. say for example if i the vendor_name then vendor_area is picked like wise vendor_phno, vendor_id, vendor_address everything must be picked from db and must fill the text boxes . How it is possible

AbdulBazith left a reply on How To Make Search Box In Laravel Or Data Table Which Filters? • 2 weeks ago

Guys i thinkdata table cant help me becoz i need multiple filters. so can anyone suggest another way which helps me. Displaying data in table format, Now need to search based on id, or name or price or address sometimes with id and name and price. like this can any one suggest idea please

AbdulBazith left a reply on How To Make Search Box In Laravel Or Data Table Which Filters? • 2 weeks ago

thank you every one for your reply. i will try the data table package.

AbdulBazith left a reply on How To Display Value To Tex Tbox Returned From Jquery In Laravel? • 2 weeks ago

@Snapey Wow thankz it worked by changing first() instead of get() and placing

$('#venn_area').val(result.ven_area);

Thank you soo much for every one who replied and gave me suggestions it makes me to understand Laravel more and more

3rd June, 2018

AbdulBazith left a reply on How To Display Value To Tex Tbox Returned From Jquery In Laravel? • 2 weeks ago

@Dhaval_patel no response the textbox is still empty..

success:function(data)

                 {

                     if(data)

                        {

                            var result=data;

                            $('#venn_area').val(result);   
                
                    }

                    },

If i give this [object][object] is displayed in venn_area text box. But if i give

success:function(data) { console.log(data); if(data) { var result=data; $('#venn_area').val(result.ven_area); } }

nothing is displayed in the venn_area text box

1st June, 2018

AbdulBazith left a reply on How To Display Value To Tex Tbox Returned From Jquery In Laravel? • 3 weeks ago

@Vilfago @Dhaval_patel

I tried both of these not working. if i use the below codes no response nothing is displaying in the text box

$('#venn_area').val(result.ven_area);

$('#venn_area').val(result.id);

AbdulBazith left a reply on How To Make Search Box In Laravel Or Data Table Which Filters? • 3 weeks ago

@Sergiu17 thankz for your search but the matter in the link is not useful becoz he mentioned the whole data in the ajax..

AbdulBazith left a reply on How To Display Value To Tex Tbox Returned From Jquery In Laravel? • 3 weeks ago

@Snapey @Dhaval_patel

it displays [object][object] in the text box[venn_area] instead of the value

31st May, 2018

AbdulBazith started a new conversation How To Display Value To Tex Tbox Returned From Jquery In Laravel? • 3 weeks ago

Guys I am trying to retrieve value from DB based on textbox and place the value in another textbox. The below jquery coding works well but it returning [object][object] in the textbox instead of the value. How to resolve it ?

   $(document).ready(function()
    {
    console.log('success');
             $("#search_text").change(function()

{ var vendor_name=$(this).val(); $.ajax({ dataType: 'json', type:'get', url:'{!! URL::to('fetch_ven_area') !!}', data:{'vendor_name':vendor_name}, success:function(data) { if(data) { var result=data; $('#venn_area').val(result); } }, } }); });

AbdulBazith left a reply on How To Make Search Box In Laravel Or Data Table Which Filters? • 3 weeks ago

sorry @Sergiu17 past 2 weeks suffered from fever so unable to see your reply. thankz for the link. but i need a data table format which also have filters and export to pdf, excel options

26th May, 2018

AbdulBazith started a new conversation How To Make Search Box In Laravel Or Data Table Which Filters? • 3 weeks ago

I am having a table in db called vendor_details consist of fields (vendor_id, vendor_name,vendor_location,vendor_area,vendor_address, vendor_contactnumber) I displayed these details in table structure in my form like this

Vendor_id Vendor_name Vendor_location Vendor_contactnumber V1 Alex India 111111 V2 Raj Mumbai 22222 V3 Abdul America 33333 V4 Jancy Hyderabad 444444

I need a search box where I can use customized search based on vendor_id , vendor_name, vendor_location and vendor-contact number. I need to display like datatable format

Filtration should be also done. How can I do this can anyone help me? Please share any video link that would help me.

AbdulBazith left a reply on How To Perform Auto Suggest In Laravel? • 3 weeks ago

Kindly any one help me for auto suggest in Laravel from DB please

23rd May, 2018

AbdulBazith left a reply on How To Make An Alert Message While Deleting In Laravel? • 4 weeks ago

@tykus thank you so much. i tried in javascript and it worked

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.