-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Invoice create invocie item multible tax
- Loading branch information
1 parent
39e6e0b
commit 7f9239e
Showing
8 changed files
with
201 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace App\Models\Income; | ||
|
||
use App\Models\Model; | ||
use App\Traits\Currencies; | ||
|
||
class InvoiceItemTax extends Model | ||
{ | ||
|
||
use Currencies; | ||
|
||
protected $table = 'invoice_item_taxes'; | ||
|
||
/** | ||
* Attributes that should be mass-assignable. | ||
* | ||
* @var array | ||
*/ | ||
protected $fillable = ['company_id', 'invoice_id', 'invoice_item_id', 'tax_id', 'name', 'amount']; | ||
|
||
public function invoice() | ||
{ | ||
return $this->belongsTo('App\Models\Income\Invoice'); | ||
} | ||
|
||
public function item() | ||
{ | ||
return $this->belongsTo('App\Models\Common\Item'); | ||
} | ||
|
||
public function tax() | ||
{ | ||
return $this->belongsTo('App\Models\Setting\Tax'); | ||
} | ||
|
||
/** | ||
* Convert amount to double. | ||
* | ||
* @param string $value | ||
* @return void | ||
*/ | ||
public function setAmountAttribute($value) | ||
{ | ||
$this->attributes['amount'] = (double) $value; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
database/migrations/2018_10_22_000000_create_invoice_item_taxes_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
|
||
class CreateInvoiceItemTaxesTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('invoice_item_taxes', function (Blueprint $table) { | ||
$table->increments('id'); | ||
$table->integer('company_id'); | ||
$table->integer('invoice_id'); | ||
$table->integer('invoice_item_id'); | ||
$table->integer('tax_id'); | ||
$table->string('name'); | ||
$table->double('amount', 15, 4)->default('0.0000'); | ||
$table->timestamps(); | ||
$table->softDeletes(); | ||
|
||
$table->index('company_id'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop('invoice_item_taxes'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters