Browse Source
Merge pull request #22 from nafiesl/bank-account-entries
Merge pull request #22 from nafiesl/bank-account-entries
Bank Account Entries from Their Own Table. Resolves #19.pull/24/head
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 223 additions and 123 deletions
-
27app/Entities/Invoices/BankAccount.php
-
4app/Http/Controllers/Invoices/InvoicesController.php
-
112app/Http/Controllers/References/BankAccountsController.php
-
12composer.lock
-
12database/factories/BankAccountFactory.php
-
36database/migrations/2018_10_30_215937_create_bank_accounts_table.php
-
2resources/lang/de/bank_account.php
-
2resources/lang/en/bank_account.php
-
2resources/lang/id/bank_account.php
-
1resources/views/bank-accounts/forms.blade.php
-
22resources/views/bank-accounts/index.blade.php
-
1routes/web/references.php
-
91tests/Feature/References/ManageBankAccountsTest.php
-
22tests/Unit/Models/BankAccountTest.php
@ -0,0 +1,27 @@ |
|||
<?php |
|||
|
|||
namespace App\Entities\Invoices; |
|||
|
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class BankAccount extends Model |
|||
{ |
|||
/** |
|||
* The attributes that are mass assignable. |
|||
* |
|||
* @var array |
|||
*/ |
|||
protected $fillable = [ |
|||
'name', 'number', 'account_name', 'description', 'is_active', |
|||
]; |
|||
|
|||
/** |
|||
* Get status attribute. |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getStatusAttribute() |
|||
{ |
|||
return $this->is_active == 1 ? __('app.active') : __('app.in_active'); |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
<?php |
|||
|
|||
use Faker\Generator as Faker; |
|||
use App\Entities\Invoices\BankAccount; |
|||
|
|||
$factory->define(BankAccount::class, function (Faker $faker) { |
|||
return [ |
|||
'name' => 'Bank '.strtoupper(str_random(4)), |
|||
'number' => str_random(10), |
|||
'account_name' => $faker->name, |
|||
]; |
|||
}); |
|||
@ -0,0 +1,36 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class CreateBankAccountsTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('bank_accounts', function (Blueprint $table) { |
|||
$table->increments('id'); |
|||
$table->string('name', 60); |
|||
$table->string('number', 30); |
|||
$table->string('account_name', 60); |
|||
$table->string('description')->nullable(); |
|||
$table->boolean('is_active')->default(1); // 1:active, 0:in_active
|
|||
$table->timestamps(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('bank_accounts'); |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
<?php |
|||
|
|||
namespace Tests\Unit\Models; |
|||
|
|||
use Tests\TestCase; |
|||
use App\Entities\Invoices\BankAccount; |
|||
use Illuminate\Foundation\Testing\DatabaseMigrations; |
|||
|
|||
class BankAccountTest extends TestCase |
|||
{ |
|||
use DatabaseMigrations; |
|||
|
|||
/** @test */ |
|||
public function a_bank_account_has_status_attribute() |
|||
{ |
|||
$bankAccount = factory(BankAccount::class)->make(['is_active' => 1]); |
|||
$this->assertEquals(__('app.active'), $bankAccount->status); |
|||
|
|||
$bankAccount->is_active = 0; |
|||
$this->assertEquals(__('app.in_active'), $bankAccount->status); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue