Created
March 18, 2020 05:29
-
-
Save DianSano/5655a2846e61d3cd32fbe509747a0092 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 Illuminate\Http\Request; | |
| use Illuminate\Support\Facades\DB; | |
| use App\Pengguna; | |
| use App\Perusahaan; | |
| class ControllerPengguna extends Controller { | |
| function index() { | |
| return Pengguna::find(8)->relasiOneMany; | |
| } | |
| function apiDaftarPengguna(Request $req) { | |
| $user = DB::table('penggunas') | |
| ->select('perusahaans.nama', 'perusahaans.id', 'penggunas.email') | |
| ->join('perusahaans', 'penggunas.id', 'perusahaans.pengguna_id') | |
| ->where('perusahaans.nama', 'gojek') | |
| ->get(); | |
| //print_r($user); | |
| return $user; | |
| } | |
| function listPengguna() { | |
| $data = Pengguna::orderBy('username', 'asc')->take(5)->get(); | |
| return view('penggunaview', ['data' => $data]); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment