Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add [amount] to fillable property to allow mass assignment on [App\Models\PurchaseTransaction]. #6

Open
LeonBuchner opened this issue May 19, 2021 · 2 comments

Comments

@LeonBuchner
Copy link

LeonBuchner commented May 19, 2021

Hello,
I cant add a transaction to the wallet_ledger.
I copied the exact same code but I will get the following error:

Add [amount] to fillable property to allow mass assignment on [App\Models\PurchaseTransaction].

When I add

protected $fillable = ['amount'];

I will get the error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'project.purchase_transactions' doesn't exist

Can somebody help me?

Models/PurchaseTransaction

<?php

namespace App\Models;

use CoreProc\WalletPlus\Contracts\WalletTransaction;
use Illuminate\Database\Eloquent\Model;

class PurchaseTransaction extends Model implements WalletTransaction
{
    public function getAmount()
    {
        return $this->amount;
    }
}

My Function:

 $user = \App\Models\User::first();

    $wallet = $user->wallet('Peso Wallet');

    $purchaseTransaction = \App\Models\PurchaseTransaction::create([
        'amount' => 100,
    ]);
    $wallet->decrementBalance($purchaseTransaction);
    
@LeonBuchner
Copy link
Author

Does anybody know a solution for that?

@MudassarCIS
Copy link

MudassarCIS commented Jun 28, 2022

Please update package , or explain
If need to increment/decrement multiple columns with sameModel how to do that , like bookings table has amount , fine, extras etc
also if add extra columns in table , like parent_id , source_of_payments (for example cash, paypal, bank etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants