mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 02:07:33 -05:00 
			
		
		
		
	Add documents to A_N_Y_T_H_I_N_G
This commit is contained in:
		
							parent
							
								
									7af826fa7f
								
							
						
					
					
						commit
						849e6040bd
					
				@ -15,6 +15,7 @@ use App\Factory\ClientFactory;
 | 
			
		||||
use App\Models\Client;
 | 
			
		||||
use App\Repositories\ClientContactRepository;
 | 
			
		||||
use App\Utils\Traits\GeneratesCounter;
 | 
			
		||||
use App\Utils\Traits\SavesDocuments;
 | 
			
		||||
use Illuminate\Http\Request;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -23,6 +24,8 @@ use Illuminate\Http\Request;
 | 
			
		||||
class ClientRepository extends BaseRepository
 | 
			
		||||
{
 | 
			
		||||
    use GeneratesCounter;
 | 
			
		||||
    use SavesDocuments;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var ClientContactRepository
 | 
			
		||||
     */
 | 
			
		||||
@ -75,6 +78,9 @@ class ClientRepository extends BaseRepository
 | 
			
		||||
            $data['name'] = $client->present()->name();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (array_key_exists('documents', $data)) {
 | 
			
		||||
            $this->saveDocuments($data['documents'], $client);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $client;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,7 @@ use App\Models\Invoice;
 | 
			
		||||
use App\Models\Payment;
 | 
			
		||||
use App\Repositories\CreditRepository;
 | 
			
		||||
use App\Utils\Traits\MakesHash;
 | 
			
		||||
use App\Utils\Traits\SavesDocuments;
 | 
			
		||||
use Illuminate\Http\Request;
 | 
			
		||||
use Illuminate\Support\Carbon;
 | 
			
		||||
 | 
			
		||||
@ -30,6 +31,7 @@ use Illuminate\Support\Carbon;
 | 
			
		||||
class PaymentRepository extends BaseRepository
 | 
			
		||||
{
 | 
			
		||||
    use MakesHash;
 | 
			
		||||
    use SavesDocuments;
 | 
			
		||||
 | 
			
		||||
    protected $credit_repo;
 | 
			
		||||
 | 
			
		||||
@ -89,6 +91,9 @@ class PaymentRepository extends BaseRepository
 | 
			
		||||
        $payment->status_id = Payment::STATUS_COMPLETED;
 | 
			
		||||
        $payment->save();
 | 
			
		||||
 | 
			
		||||
        if (array_key_exists('documents', $data)) {
 | 
			
		||||
            $this->saveDocuments($data['documents'], $payment);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /*Ensure payment number generated*/
 | 
			
		||||
        if (!$payment->number || strlen($payment->number) == 0) {
 | 
			
		||||
 | 
			
		||||
@ -12,6 +12,7 @@
 | 
			
		||||
namespace App\Repositories;
 | 
			
		||||
 | 
			
		||||
use App\Models\Product;
 | 
			
		||||
use App\Utils\Traits\SavesDocuments;
 | 
			
		||||
use Illuminate\Http\Request;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -19,6 +20,8 @@ use Illuminate\Http\Request;
 | 
			
		||||
 */
 | 
			
		||||
class ProductRepository extends BaseRepository
 | 
			
		||||
{
 | 
			
		||||
    use SavesDocuments;
 | 
			
		||||
    
 | 
			
		||||
    public function getClassName()
 | 
			
		||||
    {
 | 
			
		||||
        return Product::class;
 | 
			
		||||
@ -34,6 +37,10 @@ class ProductRepository extends BaseRepository
 | 
			
		||||
        $product->fill($data);
 | 
			
		||||
        $product->save();
 | 
			
		||||
 | 
			
		||||
        if (array_key_exists('documents', $data)) {
 | 
			
		||||
            $this->saveDocuments($data['documents'], $product);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $product;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user