first commit
This commit is contained in:
		
							
								
								
									
										21
									
								
								app/Filters/Banking/Accounts.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								app/Filters/Banking/Accounts.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace App\Filters\Banking;
 | 
			
		||||
 | 
			
		||||
use EloquentFilter\ModelFilter;
 | 
			
		||||
 | 
			
		||||
class Accounts extends ModelFilter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Related Models that have ModelFilters as well as the method on the ModelFilter
 | 
			
		||||
     * As [relatedModel => [input_key1, input_key2]].
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    public $relations = [];
 | 
			
		||||
 | 
			
		||||
    public function search($query)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->whereLike('name', $query);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										21
									
								
								app/Filters/Banking/Transactions.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								app/Filters/Banking/Transactions.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace App\Filters\Banking;
 | 
			
		||||
 | 
			
		||||
use EloquentFilter\ModelFilter;
 | 
			
		||||
 | 
			
		||||
class Transactions extends ModelFilter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Related Models that have ModelFilters as well as the method on the ModelFilter
 | 
			
		||||
     * As [relatedModel => [input_key1, input_key2]].
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    public $relations = [];
 | 
			
		||||
 | 
			
		||||
    public function search($query)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->whereLike('payment.name', $query)->whereLike('revenue.name', $query);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										26
									
								
								app/Filters/Banking/Transfers.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								app/Filters/Banking/Transfers.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace App\Filters\Banking;
 | 
			
		||||
 | 
			
		||||
use EloquentFilter\ModelFilter;
 | 
			
		||||
 | 
			
		||||
class Transfers extends ModelFilter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Related Models that have ModelFilters as well as the method on the ModelFilter
 | 
			
		||||
     * As [relatedModel => [input_key1, input_key2]].
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    public $relations = [];
 | 
			
		||||
 | 
			
		||||
    public function fromAccount($account_id)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->where('payments.account_id', $account_id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function toAccount($account_id)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->related('revenue', 'revenues.account_id', '=', $account_id);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user