Created
August 29, 2016 16:29
-
-
Save MrBeerBrewer/2fbe7f78f39cc2dd672e3c10b7d7ef93 to your computer and use it in GitHub Desktop.
This file contains 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
//Course model | |
<?php | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Course extends Model | |
{ | |
public function getTakerDets(){ | |
//return User::where('id', $this->user_id)->first()->username; | |
return User::find(1)->username; | |
} | |
} | |
//ucdets view | |
@extends('layouts.app') | |
@section('content') | |
<div class="container"> | |
<div class="row"> | |
<div class="col-md-8 col-md-offset-2"> | |
<h1>User-Course details</h1> | |
@foreach($courses as $course) | |
<h1>{{ $course->courseTitle }}</h1> | |
<p>{{ $course->courseDesc }}</p> | |
<small>Taken by student: {{ $course->getTakerDets() }}</small> | |
@endforeach | |
</div> | |
</div> | |
</div> | |
@endsection | |
// UCRController | |
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use App\Http\Requests; | |
use App\Course; | |
class UCRController extends Controller | |
{ | |
public function index() | |
{ | |
$courses = Course::all(); | |
return view('ucdets')->with('courses', $courses); | |
//return view('home', compact('users')); | |
//return view('home', ['c' => $c]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment