Question: I Am Getting 500 Error

I Am Getting 500 Error

I am getting 500 Errors on the "Add Purchase" submission, please see the attached file

S(

Shibin Mathew (Shenil)

Asked
I am getting 500 Errors on the "Add Purchase" submission, please see the attached file
Attachments
  • MS

    Mian Saleem

    Answered
    Hello,

    Can you please share the errors in the latest log file `storage/logs/`

    Thank you
  • S(

    Shibin Mathew (Shenil)

    Answered
    Please see the attached log file
  • MS

    Mian Saleem

    Answered
    Hello,

    I see the error for undefined key. Please run `php artisan migrate --force` to update the database and then try to add sale again.

    Thank you
  • S(

    Shibin Mathew (Shenil)

    Answered
    Still I am getting the error while adding the "Add Purchase"
  • MS

    Mian Saleem

    Answered
    Please check the error log again.
  • S(

    Shibin Mathew (Shenil)

    Answered
    Please see the attached files
  • MS

    Mian Saleem

    Answered
    Hello,

    I can see the error for `Undefined array key "discount_method"` If you see the line this error generated from that should be

    ```
    $v['discount_amount'] = 'order' == ($v['discount_method'] ?? null) ? (new DiscountAction())->calculate($v['discount'] ?? false, $v['total']) : 0;
    ```

    Means if not key for `discount_method` then it should fallback to `null`. I suspect that is old error. Please delete the log file and then try add purchase again. If still get error, please attach the new log file.

    Thank you
  • S(

    Shibin Mathew (Shenil)

    Answered
    now it is working fine,

    it was $v['discount_amount'] = 'order' == $v['discount_method'] ? (new DiscountAction())->calculate($v['discount'] ?? false, $v['total']) : 0;
  • MS

    Mian Saleem

    Answered
    That's strange it should be in the latest update. When did you download the file?
  • Login to Reply