Example #1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     // get all the nerds
     $nerds = Nerd::all();
     // load the view and pass the nerds
     return View::make('nerds.index')->with('nerds', $nerds);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // delete
     $nerd = Nerd::find($id);
     $nerd->delete();
     // redirect
     Session::flash('message', 'Successfully deleted the nerd!');
     return Redirect::to('nerds');
 }
Example #3
0
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
</head>
<body>
<div class="container">
@include ('layouts.navbar')

<h1>Showing {{ $nerd->name }}</h1>

<div class="jumbotron text-center">
        <h2>{{ $nerd->name }}</h2>
        <p>
            <strong>Email:</strong> {{ $nerd->email }}<br>
            <strong>Level:</strong> {{ $nerd->nerd_level }}<br><br>
            <strong><u>Groups:</u></strong><br>
                <?php 
$groups = Nerd::find($nerd->id)->groups;
?>

                @foreach($groups as $k => $v)
                    <span class="glyphicon glyphicon-star" style="color:orange"></span>
                    {{ $v->group_name }}
                    </br>
                   
                @endforeach
            
        </p>
    </div>

</div>
</body>
</html>
Example #4
0
        break;
    case "1":
        echo "Sees Sunlight";
        break;
    case "2":
        echo "Foosball Fanatic";
        break;
    case "3":
        echo "Basement Dweller";
}
?>
            </td>

            <td>
                <?php 
$groups = Nerd::find($value->id)->groups;
//print_r($groups);
?>

                @foreach($groups as $k => $v)
                    <span class="glyphicon glyphicon-star" style="color:orange"></span>
                    {{ $v->group_name }}
                    </br>
                   
                @endforeach
            </td>

             <!-- we will also add show, edit, and delete buttons -->
            <td>
                
                <!-- delete the nerd (uses the destroy method DESTROY /nerds/{id} -->