dev-master
9999999-dev https://github.com/alex-oliveira/ao-bank-accountsResources for Bank Accounts with Laravel.
MIT
The Requires
laravel alex-oliveira bank accounts
Resources for Bank Accounts with Laravel.
$ composer require alex-oliveira/ao-bank-accounts
'providers' => [ /* * Vendor Service Providers... */ AoBankAccounts\ServiceProvider::class, ],
$ php artisan vendor:publish $ composer dump
$ php artisan db:seed
public function up() { AoBankAccounts()->schema()->create('users'); }
the same that, (*1)
public function up() { Schema::create('ao_ba_bank_accounts_x_users', function (Blueprint $table) { $table->integer('user_id')->unsigned(); $table->foreign('user_id', 'fk_users_x_ao_ba_bank_accounts')->references('id')->on('users'); $table->bigInteger('bank_account_id')->unsigned(); $table->foreign('bank_account_id', 'fk_ao_ba_bank_accounts_x_users')->references('id')->on('ao_ba_bank_accounts'); $table->primary(['user_id', 'bank_account_id'], 'pk_ao_ba_bank_accounts_x_users'); }); }
public function down() { AoLogs()->schema()->drop('users'); }
the same that, (*2)
public function down() { Schema::dropIfExists('ao_ba_bank_accounts_x_users'); }
namespace App\Models; use AoBankAccounts\Models\BankAccount; use Illuminate\Database\Eloquent\Model; class User extends Model { /** * @return BankAccount[]|\Illuminate\Database\Eloquent\Relations\BelongsToMany */ public function bankAccounts() { return $this->belongsToMany(BankAccount::class, AoBankAccounts()->schema()->table($this->getTable())); } }
the same that, (*3)
return $this->belongsToMany(BankAccount::class, 'ao_ba_bank_accounts_x_users');
namespace App\Http\Controllers\Users; use AoBankAccounts\Controllers\AoBankAccountsController; use App\Models\User; class CommentsController extends AoBankAccountsController { protected $dynamicClass = User::class; }
Route::group(['prefix' => 'users', 'as' => 'users.'], function () { AoBankAccounts()->router('Users\BankAccountsController')->foreign('user_id')->make(); . . . });
$ php artisan route:list
Resources for Bank Accounts with Laravel.
MIT
laravel alex-oliveira bank accounts