Package Data | |
---|---|
Maintainer Username: | alex-oliveira |
Package Create Date: | 2017-05-30 |
Package Last Update: | 2017-05-30 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 03:11:40 |
Package Statistics | |
---|---|
Total Downloads: | 8 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
$ 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
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
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
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