partabsaifzakir

partabsaifzakir

Member Since 1 Year Ago

Experience Points
3,910
Total
Experience

1,090 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-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

Level 1
3,910 XP
Jun
02
4 months ago
Activity icon

Replied to 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

May
31
4 months ago
Activity icon

Replied to Magento 2: Can I Ask Question About Magento 2.x ?

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

Activity icon

Replied to 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

Activity icon

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.....

Feb
07
8 months ago
Activity icon

Replied to 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);
Activity icon

Replied to 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.

Activity icon

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;
        }

    }
Jan
05
9 months ago
Activity icon

Replied to How To Submit Form If The User Don't Want To Add HasMany FormItems

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

Activity icon

Replied to 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>
Activity icon

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
Activity icon

Replied to 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 ????

Jan
04
9 months ago
Activity icon

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

Activity icon

Replied to Can't Store More Than One FormItems Data To DB

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

Activity icon

Replied to 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]", now when i submit form 2 formItems stored in DB. may be there is a problem in my form, but don't know hot to resolve this.

Activity icon

Replied to 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]

dd(request->all()) results:

array:12 [▼
  "_token" => "tEDC2rrDXInWeKQzFFSyk0gRoiC19Dr4HIqpf5P1"
  "user_phone" => "kjk"
  "user_cnic" => "jkj"
  "user_dob" => "kjk"
  "user_gender" => "male"
  "user_landmark" => "[email protected]"
  "user_hfname" => "kjk"
  "user_address" => "jk"
  "user_name" => "jkj"
  "user_family_no" => "1"
  "user_email" => "[email protected]"
  "formItems" => array:1 [▼
    0 => array:6 [▼
      "family_relation" => "spuose"
      "family_name" => "fhgfgfh"
      "family_dob" => "gfghfhg"
      "family_hfname" => "ghgfghf"
      "family_phone" => "fhgfg"
      "family_email" => "[email protected]"
    ]
  ]
]
Activity icon

Replied to 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 .

Jan
03
9 months ago
Activity icon

Replied to Can't Store More Than One 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>
Activity icon

Replied to Can't Store More Than One FormItems Data To DB

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

Activity icon

Replied to Can't Store More Than One FormItems Data To DB

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

    public function store(Request $request)
    {
        $formItems = collect();
        
        // dd($formItems);
        // dd($request->all());
        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']
            ]));
        }

        $form = Form::create([
            'user_phone' => $request['user_phone'],
            'user_cnic' => $request['user_cnic'],
            'user_name' => $request['user_name'],
            'user_hfname' => $request['user_hfname'],
            'user_dob' => $request['user_dob'],
            'user_gender' => $request['user_gender'],
            'user_address' => $request['user_address'],
            'user_landmark' => $request['user_landmark'],
            'user_email' => $request['user_email'],
            'user_family_no' => $request['user_family_no']
        ]);

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

Replied to Can't Store More Than One FormItems Data To DB

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

Activity icon

Replied to Can't Store More Than One 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.

Activity icon

Replied to Can't Store More Than One 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>
Activity icon

Started a new conversation Can't Store More Than One FormItems Data To DB

===========================QUESTION UPDATED===========================

I'm using Laravel 5.7.*

I have a form and it's formItems, Like form HasMany formItems and formItems belongsTo form, when i hit submit, i see in DB only one formItems is stored, although i try to store more than one formitem

Here is my store method:

    public function store(Request $request)
    {
        $formItems = collect();
        
        // dd($request);
        // dd($request->formItems);
        // dd($familymember);
        
        foreach($request['formItems'] as $formItem) {
            $formItems->push(new FormItem ([
                'family_phone' => $formItem ['family_phone'],
                'family_name' => $formItem ['family_name'],
            ]));
            }
        
        $form = Form::create([
            'user_phone' => $request['user_phone'],
            'user_cnic' => $request['user_cnic'],
            ]);
        
        $form->formItems()->saveMany($formItems);
    }

Here is my HTML for formItems:

<form>
  <fieldset>
    <!--====DYNAMIC FORMITEMS FILEDS====-->
    <table class="table table-bordered fieldGroup">
      <tbody>
        <tr>
          <td><input type="text" name="formItems[0][family_name]" class="form-control form-control-sm" placeholder="Full Name"></td>
          <td><input type="text" name="formItems[0][family_phone]" class="form-control form-control-sm" placeholder="Phone"></td>
          <td colspan="3">
            <a href="javascript:void(0)" class="btn btn-success addMore"><span class="glyphicon glyphicon glyphicon-plus" aria-hidden="true"></span>+</a>
          </td>
        </tr>
      </tbody>
    </table>
    <div class="form-group">

      <div class="text-center">
        <button class="btn btn-success" type="submit">Submit</button>
      </div>

    </div>
  </fieldset>
</form>

<!--====CLONE DYNAMIC FORMITEMS FILEDS====-->
<table class="table table-bordered fieldGroupCopy" style="display: none;">
  <tbody>
    <tr>
      <td><input type="text" name="formItems[0][family_name]" class="form-control form-control-sm" placeholder="Full Name"></td>
      <td><input type="text" name="formItems[0][family_phone]" class="form-control form-control-sm" placeholder="Phone"></td>
      <td><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>x</a></td>
    </tr>
  </tbody>
</table>

From Model:

class Form extends Model
{
    protected $fillable = [
        'user_phone',
        'user_cnic',
    ];

    protected $with = [
        'formItems',
    ];
    
    public function formItems()
    {
        return $this->hasMany(FormItem::class);
    }

FromItem Model:

class FormItem extends Model
{
    protected $fillable = [
        'form_id',
        'family_name',
        'family_phone',
    ];
    
    public function form()
    {
        return $this->belongsTo(Form::class);
    }
}
Activity icon

Replied to When I Add Dynamic Field JQuery Datepicket Is Not Wotking

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

Activity icon

Replied to 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>
Jan
02
9 months ago
Activity icon

Replied to 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();
    });
});
Activity icon

Replied to When I Add Dynamic Field JQuery Datepicket Is Not Wotking

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

Activity icon

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);
  }
});
Dec
05
10 months ago
Activity icon

Replied to 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);
Activity icon

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);

        }
Dec
01
10 months ago
Activity icon

Replied to 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
Activity icon

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

Nov
29
10 months ago
Activity icon

Replied to Html2pdf: How To Hide Div From PDF?

@TPANE24 - I did this:

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

Started a new conversation Html2pdf: How To Hide Div From PDF?

================================================QUESTION UPDATED================================================

I'm using html2pdf

I can Generate PDF of my Invoice, but i don't want a <div class="div-dont-want-to-display"> to display on my PDF, how can i do that ?

My Vue.js Component:

        <template>
          <div class="invoice p-3 mb-3" id="mydiv">
          
          <div class="div-dont-want-to-display">
           
          <!-- 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():

    import html2pdf from 'html2pdf.js'

    export default {

      methods: {
        createPDF() {
          var element = document.getElementById('mydiv');

          var opt = {
            margin: 0,
            filename: 'myfile.pdf',
            image: {type: 'jpeg',quality: 0.98},
            html2canvas: {scale: 2},
            jsPDF: {
              unit: 'mm',
              format: [280, 350],
              orientation: 'portrait'
            }
          };

          html2pdf().set(opt).from(element).save();
        },
      }
    }
Nov
26
10 months ago
Activity icon

Replied to 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>

Thanks For You Support

Activity icon

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 ?

Nov
16
11 months ago
Activity icon

Replied to 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.

Activity icon

Replied to 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.

Activity icon

Replied to Can't See All Option In Dropdown Because Of Pagination

@JLRDW - @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 ?

Nov
15
11 months ago
Activity icon

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

Activity icon

Replied to How To Search With Vendor Name As Well ???

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

Activity icon

Replied to How To Search With Vendor Name As Well ???

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

Activity icon

Replied to 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.

Activity icon

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

Nov
14
11 months ago
Activity icon

Replied to DELETED

Deleted

Activity icon

Replied to How To Display My Invoice Data In Invoice Template

@robstar

I did something like this, it's working for me, can u just review it for me:

<router-link> to the Invoice View component

<router-link v-bind:to="{name: 'ctInvoiceView', params: {id: ctInvoice.id}}">
  <i class="fas fa-eye fa-lg text-blue"></i>
</router-link>

Getting Data of Specific Invoice ID Like This:

created: function() {
  axios
    .get("/api/ct-invoice/" + this.$route.params.id)
    .then(({
      data
    }) => {
      console.log(data);
      this.form = new Form(data);
    })
    .catch(error => {
      console.log(error.response);
    });
},
Nov
09
11 months ago
Activity icon

Started a new conversation How To Display My Invoice Data In Invoice Template

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

I have invoices table, i need to display specific invoice in a new component, so user can see whatever invoice he wants or print that invoice.

I don't know how to do that, i'm just playing around, if you could help me out, i'll be very grateful to you.

<router-link> to the Invoice View component

<router-link to="/ct-invoice-view" @click="openInvoice(ctInvoice)">
  <i class="fas fa-eye fa-lg text-blue"></i>
</router-link>

Displaying Customer information here like this:

<div class="col-sm-4 invoice-col">
  <address v-for="ctInvoice in ctInvoices" :key="ctInvoice.id">
     <strong>Customer Info</strong><br>
     Name: <span>{{ ctInvoice.customer.customer_name }}</span>

Invoice view component data() & method{}

data() {
    return {
      ctInvoices: {},
      customers: null
    };
  },
  methods: {
    openInvoice(ctInvoice) {
      axios
        .get("api/ct-invoice/show/" + this.viewInvoice)
        .then(({
          data
        }) => (this.ctInvoices = data.data));
    },

Image for Better Understanding enter image description here

[![enter image description here][2]][2]

Nov
06
11 months ago