File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,46 @@ laravel-wallet - Easy work with virtual wallet.
1919*  ** PHP Version** : 7.1+ 
2020*  ** [ Composer] ( https://getcomposer.org/ ) :**  ` composer require bavix/laravel-wallet ` 
2121
22+ ### Run Migrations  
23+ Publish the migrations with this artisan command:
24+ ``` 
25+ php artisan vendor:publish --provider="Depsimon\Wallet\WalletServiceProvider" --tag=migrations 
26+ ``` 
27+ 
28+ ### Configuration  
29+ You can publish the config file with this artisan command:
30+ ``` 
31+ php artisan vendor:publish --provider="Depsimon\Wallet\WalletServiceProvider" --tag=config 
32+ ``` 
33+ 
34+ ### Usage  
35+ Add the HasWallet trait to model.
36+ ``` 
37+ use Bavix\Wallet\Traits\HasWallet; 
38+ use Bavix\Wallet\Interfaces\Wallet; 
39+ 
40+ class User extends Model implements Wallet 
41+ { 
42+     use HasWallet; 
43+ } 
44+ ``` 
45+ 
46+ Now we make transactions.
47+ 
48+ ``` 
49+ $user = User::first(); 
50+ $user->balance; // int(0) 
51+ 
52+ $user->deposit(10); 
53+ $user->balance; // int(10) 
54+ 
55+ $user->withdraw(1); 
56+ $user->balance; // int(9) 
57+ 
58+ $user->forceWithdraw(200); 
59+ $user->balance; // -191 
60+ ``` 
61+ 
2262--- 
2363Supported by
2464
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments