add api bank

This commit is contained in:
Zakwan Hamdan
2020-11-03 10:50:13 +08:00
parent 6aa1d91f5b
commit ba7e18eee1
3 changed files with 43 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Bank extends Model
{
protected $table = 'bank';
/**
* The attributes that are mass assignable.
*
* @var array
*/
// protected $fillable = [
// ];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
}
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App\Http\Controllers;
use App\Bank;
use Illuminate\Http\Request;
class BankController extends Controller
{
public function showAllBank(){
$bank = Bank::on('mysql7')->get();
return response()->json($bank);
}
}
+2
View File
@@ -70,4 +70,6 @@ $router->group(['prefix'=>'api'], function () use ($router){
$router->get('negeri/{kodnegeri}',['uses'=>'NegeriController@showOneNegeri']);
$router->get('daerah/{koddaerah}',['uses'=>'DaerahController@showOneDaerah']);
$router->get('bank',['uses'=>'BankController@showAllBank']);
});