partabsaifzakir

partabsaifzakir

Member Since 8 Months Ago

Experience Points 3,860
Experience Level 1

1,140 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 7
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

02 Jun
2 weeks ago

partabsaifzakir left a reply on Magento 2: Can I Ask Question About Magento 2.x ?

@HONDNL - I agree with you bro but let me tell you that magento 2 and its later version imporving day by day, and in windows Magento runs too slow but in Linux Ubuntu it works too fast....

@sna

31 May
2 weeks ago

partabsaifzakir left a reply on Magento 2: Can I Ask Question About Magento 2.x ?

@SNAPEY - Hahahaha no issue brother, just wish me luck :D

partabsaifzakir left a reply on Magento 2: Can I Ask Question About Magento 2.x ?

@SNAPEY - Yes i'm very sure, i made my question as clear as possible, BTW here is the link of my question, if you could help :) https://magento.stackexchange.com/questions/276572/magento-2-3-how-to-initialize-js?noredirect=1#comment394493_276572

partabsaifzakir started a new conversation Magento 2: Can I Ask Question About Magento 2.x ?

Hi,

i just want to confirm, may i ask question about magento coz i'm stuck on something and can't find any solution i also posted on stack and magento.community but got no solution.....

07 Feb
4 months ago

partabsaifzakir left a reply on How To Hide Option From Select DropDown If Same Id Exist In Both Table

I've made this function in my Sale Model:

        public function getRemainingSale() {
            $sql = "SELECT `sale_id`,";
            $sql .= " `sale_no`,";
            $sql .= " `customer_name`,";
            $sql .= " `sale_amount`";
            $sql .= " FROM   sale";
            $sql .= " WHERE  sale_id NOT IN (SELECT sale_id FROM `receipt`)";

            $query = $this->db->query($sql);
            $record = $query->rows;
            return $record;
        }

And call Sale Model with that function in receipt controller:

            $this->model['sale'] = $this->load->model('sale/sale');
            $this->data['sales'] = $this->model['sale']->getRemainingSale();
    //        d($this->data['sales'],true);

partabsaifzakir left a reply on How To Hide Option From Select DropDown If Same Id Exist In Both Table

@SNAPEY - Not Using Eloquent Bro, Its Like Core PHP based on MVC structure.

partabsaifzakir started a new conversation How To Hide Option From Select DropDown If Same Id Exist In Both Table

I'm using PHP based on MVC structure, i have 2 tables sale & receipt, when a user want to make receipt he/she will select dropdown option, Sale No. coming from DB sale table, which has a value of sale_id, so that user make recept on behalf of sale, and sale_id store in receipt table, i want to achieve that if sale_id exist in receipt table, hide that option from Select DropDown Options.

Like in Below Images, i have 3 sale record and 1 receipt record, receipt record contains sale_id, i want to hide that Sale No. from select dropdown option.

SALE TABLE enter image description here

RECEIPT TABLE enter image description here

Select Option In Receipt

    <select class="form-control" id="sale_id" name="sale_id">
      <option disabled selected value="">Select One</option>
      <?php foreach($sales as $sale): ?>
      <option value="<?php echo $sale['sale_id']; ?>" <?php echo ($sale_id==$ sale[ 'sale_id']? 'selected="selected"': ''); ?>>
        <?php echo $sale['sale_no']; ?>&nbsp;=>&nbsp;
        <?php echo $sale['customer_name']; ?>
      </option>
      <?php endforeach; ?>
    </select>

My Receipt Controller : That How I'm getting Data From Sale Table In My DropDown Option

    $this->model['sale'] = $this->load->model('sale/sale');
    $this->data['sales'] = $this->model['sale']->getRows();

My Receipt Model

    class ModelTransactionReceipt extends HModel {

        protected function getTable() {
            return 'receipt';
        }

        protected function getView() {
            return 'vw_receipt';
        }

        public function getMaxReceiptNo(){
            $sql = "SELECT MAX(receipt_no) as max_no FROM `receipt`";
            $query = $this->db->query($sql);
            $record = $query->row;

            if(empty($record['max_no'])) {
                $max_no =  1;
            } else {
                $max_no =  $record['max_no']+1;
            }

            return $max_no;
        }

    }
05 Jan
5 months ago

partabsaifzakir left a reply on How To Submit Form If The User Don't Want To Add HasMany FormItems

@SNAPEY - getting error when i send form without sending formItems.

partabsaifzakir left a reply on Laravel Form Validation Message View

Brother i did it like this, it work OK for me :)

<input type="text" name="user_dob" class="form-control datepicker" placeholder="Date of Birth: ">

<label for="user_phone" class="text-danger">{{ $errors->first('user_dob')}}</label>

partabsaifzakir started a new conversation Laravel Form Validation Message View

Sorry for my title.

I'm using Laravel 5.7.*

Right now my form validation message view is like this: enter image description here

But i need it like this, i mean atleast error message appear below input fields: enter image description here

Displaying Error Like This:

    @if(count($errors)>0)
      <ul>
      @foreach($errors->all() as $error)
        <li class="alert alert-danger">
          {{$error}}
        </li>
        @endforeach
      </ul>
    @endif

partabsaifzakir left a reply on How To Submit Form If The User Don't Want To Add HasMany FormItems

@EQUALIZEE - i want exactly what you said brother, formItems in my case are dynamically added fields & form is like it's parent form, if user want to add formItems after filling parent form he/she can add as many formItems as he/she want, but sometimes user don't want to add formItems and hit submit and only parent data populate into DB.... i just don't know how how to do that, could you help me out ????

04 Jan
5 months ago

partabsaifzakir started a new conversation How To Submit Form If The User Don't Want To Add HasMany FormItems

I'm using Laravel 5.7.*.

I have form which hasMany formItems, Like a form hasMany formItems & formItems belongsTo form, but i want an if between them, that if user don't want to add formItems only form data store in DB and if user want to add formItems both data store in DB, right now, it's storing both data in DB, but i don't how to make it store if user don't want formItems.

Here is my FormController store method():

    public function store(Request $request)
    {
        //SUBMITTING FORM DATA
        $form = Form::create([
            'user_phone' => $request['user_phone'],
            'user_name' => $request['user_name'],
        ]);
        
        //SUBMITTING FORMITEMS DATA
        $form_items = [];
        foreach($request['formItems'] as $form_item) {
            $form_items[] = new FormItem([
                'form_id' => $form->id,
                'family_name' => $form_item ['family_name'],
                'family_phone' => $form_item ['family_phone'],
            ]);
        }
        $form->formItems()->saveMany($form_items);
    }

Image For Better Understanding: enter image description here

enter image description here

partabsaifzakir left a reply on Can't Store More Than One FormItems Data To DB

@signar @zion @snapey My error is resolved Thanks for supporting me bro..... :)

partabsaifzakir left a reply on Can't Store More Than One FormItems Data To DB

@SNAPEY - I have 2 formItems forms, one that is displaying on frontend, other is its clone, which i added dynamically using jQuery, i did this in original form name="formItems[0][family_name]" and did this in clone form name="formItems[1][family_name]"

partabsaifzakir left a reply on Can't Store More Than One FormItems Data To DB

@SNAPEY - Sir, when i did this: name="formItems[][family_name]" it shows me an error of Undefined index: family_name, and when i see in dev tool (network->header) form data is like this:

_token: tEDC2rrDXInWeKQzFFSyk0gRoiC19Dr4HIqpf5P1
user_phone: jjjjj
user_cnic: hjhjhj
user_dob: 14 Jan 19
user_gender: female
user_landmark: ghjghjghjghjghj
user_hfname: HHH
user_address: hjkh
user_name: hhhh
user_family_no: 1
user_email: [email protected]
formItems[][family_relation]: wife
formItems[][family_name]: hhjk
formItems[][family_dob]: hjhj
formItems[][family_hfname]: hj
formItems[][family_phone]: hj
formItems[][family_email]: [email protected]
formItems[][family_relation]: daughter
formItems[][family_name]: hhjk
formItems[][family_dob]: hjhj
formItems[][family_hfname]: hj
formItems[][family_phone]: hj
formItems[][family_email]: [email protected]

partabsaifzakir left a reply on Can't Store More Than One FormItems Data To DB

@signar @zion @snapey , I've done some changed, Please See the Updated Question's Description & Code .

03 Jan
5 months ago

partabsaifzakir left a reply on Can't Store Form & Its FormItems Data To DB

@ZION - Did this getting the same error. Invalid argument supplied for foreach()

    public function store(Request $request)
    {
        $formItems = collect();
        
        // dd($formItems);
        // dd($request->all());

        foreach($request->familymembers as $familymember) {
            $formItems = new FormItem(); // is a family member a formItem?!?
            
            $formItems->form_id = $familymember->form_id;
            $formItems->family_relation = $familymember->family_relation;
            $formItems->family_name = $familymember->family_name;
            // continue according to what you need.
        }

        $form = Form::create([
            'user_phone' => $request['user_phone'],
            'user_cnic' => $request['user_cnic'],
            'user_name' => $request['user_name'],
        ]);
        $form->formItems()->saveMany($formItems);
    }

My HTML:

        <td><input type="text" name="familymembers[0][family_name]" class="form-control form-control-sm" placeholder="Full Name"></td>
        <td><input type="text" name="familymembers[0][family_dob]" class="form-control form-control-sm datepicker" placeholder="Date of Birth: "></td>

partabsaifzakir left a reply on Can't Store Form & Its FormItems Data To DB

@ZION - is their any way to store that family data also ???

partabsaifzakir left a reply on Can't Store Form & Its FormItems Data To DB

@SIGNAR - I did this, but when i submit my form, only User data store in database not Family Data...

        foreach ($formItems as $formItem)
        {
            $formItems->push(new FormItem ([
                'form_id' => $formItem['form_id'],
                'family_relation' => $formItem['family_relation'],
                'family_name' => $formItem['family_name'],
                'family_dob' => $formItem['family_dob'],
                'family_phone' => $formItem['family_phone'],
                'family_emial' => $formItem['family_emial'],
                'family_hfname' => $formItem['family_hfname']
            ]));
        }

partabsaifzakir left a reply on Can't Store Form & Its FormItems Data To DB

@SIGNAR - there is no field in my DB named as $request['formItems']....

partabsaifzakir left a reply on Can't Store Form & Its FormItems Data To DB

@SIGNAR - There are two for One for User form and Other for User Family formItems, so i made relation between them, like Form hasMany FormItems, i just need to store their data in DB, thats all i want.

partabsaifzakir left a reply on Can't Store Form & Its FormItems Data To DB

@SIGNAR - formItems HTML field:

<tr>
  <td><input type="text" name="family_name[]" class="form-control form-control-sm" placeholder="Full Name"></td>
  <td><input type="text" name="family_dob[]" class="form-control form-control-sm datepicker" placeholder="Date of Birth: "></td>
  <td><input type="text" name="family_fhname[]" class="form-control form-control-sm" placeholder="Father/Husband Name"></td>
</tr>

partabsaifzakir started a new conversation Can't Store Form & Its FormItems Data To DB

I'm using Laravel 5.7.*

I have a form which and formItems, Like a form HasMany formItems and formItems belongsTo form, i want to store them in DB, but when i do that i got an error like Invalid argument supplied for foreach().

Here is my store method:

    public function store(Request $request) {
      $formItems = collect();

      foreach($request['formItems'] as $formItem) {
        $formItems -> push(new FormItems([
          'form_id' => $formItem['form_id'],
          'family_relation' => $formItem['family_relation'],
          'family_name' => $formItem['family_name'],
        ]));
      }
      $form = Form::create([
        'user_phone' => $request['user_phone'],
        'user_name' => $request['user_name'],
        'user_dob' => $request['user_dob'],
        'user_gender' => $request['user_gender'],
      ]);

      $form -> formItems() -> saveMany($formItems);
    }

partabsaifzakir left a reply on When I Add Dynamic Field JQuery Datepicket Is Not Wotking

@ZION - BTW i tried your code its not working... :(

partabsaifzakir left a reply on When I Add Dynamic Field JQuery Datepicket Is Not Wotking

fieldGroupCopy is the clone of the table which i want to append.... Look at this:

<form>
  <fieldset>
    <table class="table table-bordered fieldGroup">
      <tbody>
        <tr>
          <td><input type="text" name="myName[]" class="form-control form-control-sm" placeholder="Full Name"></td>
          <td><input type="text" name="myDob[]" class="form-control form-control-sm datepicker" placeholder="Date of Birth: "></td>
        </tr>
        <tr>
          <td colspan="3">
            <a style="align-items: center; justify-content: center; display: flex;" href="javascript:void(0)" class="btn btn-success addMore"><span class="glyphicon glyphicon glyphicon-plus" aria-hidden="true"></span> Add</a>
          </td>
        </tr>
      </tbody>
    </table>
  </fieldset>
</form>

<!--COPY THIS TABLE-->
<table class="table table-bordered fieldGroupCopy" style="display: none;">
  <tbody>
    <tr>
      <td><input type="text" name="myName[]" class="form-control form-control-sm" placeholder="Full Name"></td>
      <td><input type="text" name="myDob[]" class="form-control form-control-sm datepicker" placeholder="Date of Birth: "></td>
    </tr>
    <tr>
      <td colspan="3">
        <a style="align-items: center; justify-content: center; display: flex;" href="javascript:void(0)" class="btn btn-danger remove"><span class="glyphicon glyphicon glyphicon-remove" aria-hidden="true"></span> Remove</a>
      </td>
    </tr>
  </tbody>
</table>
02 Jan
5 months ago

partabsaifzakir left a reply on When I Add Dynamic Field JQuery Datepicket Is Not Wotking

@ZION - This is my dynamicAdd jQuery where should i add that ?

$(document).ready(function(){
    //group add limit
    var maxGroup = 10;
    
    //add more fields group
    $(".addMore").click(function(){
        if($('body').find('.fieldGroup').length < maxGroup){
            var fieldHTML = '<table class="table table-bordered fieldGroup">'+$(".fieldGroupCopy").html()+'</table>';
            $('body').find('.fieldGroup:last').after(fieldHTML);
        }else{
            alert('Maximum '+maxGroup+' groups are allowed.');
        }
    });
    
    //remove fields group
    $("body").on("click",".remove",function(){ 
        $(this).parents(".fieldGroup").remove();
    });
});

partabsaifzakir left a reply on When I Add Dynamic Field JQuery Datepicket Is Not Wotking

@ZION - could you help me with some code if you don't mind...

partabsaifzakir started a new conversation When I Add Dynamic Field JQuery Datepicket Is Not Wotking

I'm using jQuery datepicker, when i add dynamic fields, datepicker is not working on dynamically added fields...

Thanks In Advance.

My HTML Date Type Field:

<td><input type="text" name="myDob[]" class="form-control form-control-sm datepicker" placeholder="Date of Birth: "></td>

My DatePicker jQuery:

// We don't want the val method to include placehoder value, so removing it here.
var $valFn = $.fn.val;
$.fn.extend({
  val: function() {
    var valCatch = $valFn.apply(this, arguments);
    var placeholder = $(this).attr("placeholder");

    // To check this val is called to set value and the val is for datePicker element 
    if (!arguments.length && this.hasClass('hasDatepicker')) {
      if (valCatch.indexOf(placeholder) != -1) {
        return valCatch.replace(placeholder, "");
      }
    }
    return valCatch;
  }
});

// Insert placeholder as prefix in the value, when user makes a change.
$(".datepicker").datepicker({
  onSelect: function(arg) {
    $(this).val($(this).attr("placeholder") + arg);
  }
});
05 Dec
6 months ago

partabsaifzakir left a reply on Laravel Invoice & InvoiceItems - How To Update?

Yeah i got it.... !!!

First, i deleted child records:

$ticketInvoice->ticketInvoiceItems()->delete();

Then i store the new ones:

    $ticketInvoiceItems = collect();

    foreach($request['ticketInvoiceItems'] as $invoiceItem) {
        $ticketInvoiceItems->push(new TicketInvoiceItems ([
            'passenger_name' => $invoiceItem ['passenger_name'],
            'ticket_no' => $invoiceItem ['ticket_no'],
            'fares' => $invoiceItem ['fares'],
            'sub_total' => $invoiceItem ['sub_total']
        ]));
    }

    $ticketInvoice->ticketInvoiceItems()->saveMany($ticketInvoiceItems);

partabsaifzakir started a new conversation Laravel Invoice & InvoiceItems - How To Update?

I'm using Laravel 5.7 & VueJs 2.5.* ...

I have two table TicketInvoice & TicketInvoiceItems, with a relation like, TicketInvoice hasMany TicketInvoiceItems & TicketInvoiceItems belongsTo TicketInvoice...

I can successfully create TicketInvoice & TicketInvoiceItems, but i don't know how to update it...

Here is my store method (Working):

        public function store(Request $request)
        {   
            $ticketInvoiceItems = collect();

            foreach($request['ticketInvoiceItems'] as $invoiceItem) {
            $ticketInvoiceItems->push(new TicketInvoiceItems ([
                'passenger_name' => $invoiceItem ['passenger_name'],
                'ticket_no' => $invoiceItem ['ticket_no'],
                'fares' => $invoiceItem ['fares'],
                'sub_total' => $invoiceItem ['sub_total']
            ]));
            }

            $ticketInvoice = TicketInvoice::create([
                'vendor_id' => $request['vendor_id'],
                'ticket_invoice_no' => $request['ticket_invoice_no'],
                'ticket_invoice_date' => $request['ticket_invoice_date'],
                'ticket_invoice_fares_total' => $request['ticket_invoice_fares_total'],
                'ticket_invoice_grand_total' => $request['ticket_invoice_grand_total'],
            ]);

            $ticketInvoice->ticketInvoiceItems()->saveMany($ticketInvoiceItems);
        }

Here is my update method (Not-Working :'( ):

        public function update(Request $request, $id)
        {
            $ticketInvoice = TicketInvoice::findOrFail($id);

            $ticketInvoiceItems = collect();

            foreach($request['ticketInvoiceItems'] as $invoiceItem) {
                $ticketInvoiceItems->push(new TicketInvoiceItems ([
                    'passenger_name' => $invoiceItem ['passenger_name'],
                    'ticket_no' => $invoiceItem ['ticket_no'],
                    'fares' => $invoiceItem ['fares'],
                    'sub_total' => $invoiceItem ['sub_total']
                ]));
                }
                $ticketInvoice->update($request->all());
                $ticketInvoice->ticketInvoiceItems()->update($ticketInvoiceItems);

        }
04 Dec
6 months ago
01 Dec
6 months ago

partabsaifzakir left a reply on I Made Route In API But It's Not Showing In Route:List

I was not doing this that's why i'm getting this issue:

I have my routes cached and need to clear the cache.

laravel.com/docs/5.7/controllers#route-caching

php artisan route:cache
php artisan route:clear

partabsaifzakir started a new conversation I Made Route In API But It's Not Showing In Route:List

I made Route in my routes->api, but when i do php artisan route:list, it show me all routes except this route.

Route::apiResources([
    'vh-invoice' => 'API\VhInvoiceController'
]);

Even when i remove some routes its shows me the same route:list, like i removed these routes below, but in route:list it shows me the removed routes also, as you can see in image below.

Route::get('findVTI', 'API\[email protected]');
Route::get('selectVTI', 'API\[email protected]');

enter image description here

29 Nov
6 months ago

partabsaifzakir left a reply on Html2pdf: How To Hide Div From PDF?

@TPANE24 - I did this:

<div id="element-to-hide" data-html2canvas-ignore="true"></div>
28 Nov
6 months ago

partabsaifzakir started a new conversation JsPDF With Vuejs: How To Download PDF With <HTML> ?

I'm using Laravel 5.7 & VueJs 2.5.* ...

Consider Me New

I want to download my Invoice as PDF.

My Vue.js Component:

    <template>
      <div class="invoice p-3 mb-3">
              
        <!-- AND MANY MORE DIV'S -->

        <!--BUTTON TO DOWNLOAD PDF-->
        <a href @click.prevent="createPDF"class="btn btn-primary float-right">
          <i class="fa fa-download"></i> Generate PDF </a>
      </div>
    </template>

Method for createPDF(). For now i'm just downloading PDF with text "Hello World":

    <script>
    import jsPDF from 'jspdf'

    export default {

    methods: {
      createPDF() {
        let pdfName = 'test'; 
        var doc = new jsPDF();
        doc.text("Hello World", 10, 10);
        doc.save(pdfName + '.pdf');
        },
      }
    }
    </script>
26 Nov
6 months ago

partabsaifzakir left a reply on Vue Filter To Convert Amount In Numbers To Amount In Words

@REALRANDYALLEN - Did something like this:

npm install number-to-words

In app.js

var converter = require('number-to-words');

Vue.filter('toWords', function (value) {
  if (!value) return '';
  return converter.toWords(value);
})

HTML:

<span>{{form.ct_invoice_grand_total | toWords | capitalize}} rupees only.</span>

partabsaifzakir left a reply on Vue Filter To Convert Amount In Numbers To Amount In Words

@REALRANDYALLEN - Don't know how to use that in my Vue component, can't understand their documentation.

partabsaifzakir started a new conversation Vue Filter To Convert Amount In Numbers To Amount In Words

I'm using Laravel 5.7 & VueJs 2.5.* ...

I working on Invoice application, while displaying invoice i want my grand total amount to be converted in words. Like this:

Grand Total In Numbers = 10,000

Grand Total In Words = Ten thousand rupees only

Is their any Vue Filter or any way to do that ?

20 Nov
6 months ago

partabsaifzakir left a reply on Can't See All Option In Dropdown Because Of Pagination

@jlrdw @cronix could guys help me how to use select2 from scratch, i saw their documentation but i don't understand...

17 Nov
7 months ago

partabsaifzakir left a reply on Can't See All Option In Dropdown Because Of Pagination

@JLRDW - Could you send me some links, i watched some tutorials, apply on my code but its not working

16 Nov
7 months ago

partabsaifzakir left a reply on Can't See All Option In Dropdown Because Of Pagination

@jlrdw - @cronix i did to do it with auto complete but failed many time could you guide me some how.

partabsaifzakir left a reply on Can't See All Option In Dropdown Because Of Pagination

@JLRDW - Yes Brother u r right i think i have to go with autocomplete feature, Lets try that.

partabsaifzakir left a reply on Can't See All Option In Dropdown Because Of Pagination

@CRONIX - Brother if i did vendor->all() i have a component for vendor in which i have a table of vendor data i have to paginate that. also i have a dropdown of ticket_invoice_noin another component where i'm also getting only 10 results coz i'm paginating Ticket->paginate(10). I think i have to go with autocomplete feature, can u help me with that ?

15 Nov
7 months ago

partabsaifzakir started a new conversation Can't See All Option In Dropdown Because Of Pagination

I'm using Laravel 5.7 & VueJs 2.5.* ...

I did pagination for my invoice as well as vendor table. i have a create invoice form in which i have dropdown option for selecting vendors, i have more than 20 vendors, after doing pagination i see in my form i have only 10 vendors in my dropdown option... I don't know how to fix this issue.

Did Pagination Like this:

In HTML

    <!--PAGINATION FOR VENDORS TABLE -->
    <pagination :data="ticketInvoices" @pagination-change-page="getResults"></pagination>

    <!--PAGINATION FOR VENDORS TABLE -->
    <pagination :data="vendors" @pagination-change-page="getResults"></pagination>

methods:{} of both pagination

    //METHOD FOR INVOICE
    getResults(page = 1) {
      axios.get("api/ticket-invoice?page=" + page).then(response => {
        this.ticketInvoices = response.data;
      });
    },

    //METHOD FOR VENDOR
    getResults(page = 1) {
      axios.get("api/vendor?page=" + page).then(response => {
        this.vendors = response.data;
      });
    },

InvoiceController & VendorController

    /*Invoice Controller*/
    class TicketInvoiceController extends Controller
    {
        public function index()
        {
            $ticketInvoices = TicketInvoice::orderBy('created_at', 'desc')->paginate(10);
            return $ticketInvoices;
        }

    /*Invoice Controller*/
    class VendorController extends Controller
    {
        public function index()
        {
            $vendor = Vendor::paginate(10);
            return $vendor;
        }

Before Pagination enter image description here

After Pagination enter image description here

partabsaifzakir left a reply on How To Search With Vendor Name As Well ???

@SHUSHKIN - Thanks Brother It's Working.... :)

partabsaifzakir left a reply on How To Search With Vendor Name As Well ???

@ZOROASTER - Can u help me with some code if u don't mind ?

partabsaifzakir left a reply on How To Search With Vendor Name As Well ???

@zoroaster Brother vendor_company_name is not a column in my ticket-invoices table, it's in my vendors table, i think the problem is in my ticketInvoicecontroller, but i don't know how to fix that.

partabsaifzakir started a new conversation How To Search With Vendor Name As Well ???

I'm using Laravel 5.7 & VueJs 2.5.* ...

I have a table with invoice data in it and a invoice is related to the vendor so i also displayed the vendor name in the table, i'm using search feature it works when i search invoice number, but when i want to search with vendor name, its not working.

i did something like this:

I DID THIS IN SCRIPT

    mounted() {
        Fire.$on("searching", () => {
          let query = this.$parent.search;
          axios
            .get("api/findVTI?q=" + query)
            .then(data => {
              this.ticketInvoices = data.data;
            })
            .catch();
        });

I MADE A ROUTE

Route::get('findVTI', 'API\[email protected]');

IN MY INVOICE CONTROLLER I DID THIS

        public function searchVTI()
        {
            if($search = \Request::get('q')){
                $VTI = TicketInvoice::where(function($query) use ($search){
                    $query->where('ticket_invoice_no','LIKE',"%$search%")
                          ->orWhere('ticket_invoice_grand_total','LIKE',"%$search%")
                          ->orWhere('vendor_company_name','LIKE',"%$search%");
                })->paginate(10);
            }else{
                return TicketInvoice::paginate(10);
            }
            return $VTI;
        }

When i write this line: ->orWhere('vendor_company_name','LIKE',"%$search%"); i got an error in console that, vendor_company_name does not exist in ticket_invoices.

I play around with many thing but didn't succeed...

Image For Better Understanding: enter image description here