Created
January 11, 2021 00:28
-
-
Save EricMcWinNer/d2102ef974ebc49488269970a1c426e9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
namespace App\Http\Controllers; | |
use App\Models\Broker; | |
class RandomController extends Controller { | |
public function getWallet(){ | |
$broker = Broker::find(1); // Get a Broker Instance | |
$wallet = $broker->wallet; // Get the Wallet that this Broker has | |
// Do whatever with it | |
return response(['wallet' => $wallet], 200); | |
} | |
public function getWalletOwner() { | |
$wallet = Wallet::find(1); // Get a Wallet instance | |
$owner = $wallet->walletable; // Get whatever owns this wallet, whether it's a Broker or Company; | |
// Do whatever with it | |
return response(['owner' => $owner], 200); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment