/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     if (empty(loadSerieWithIdOrTitle($id))) {
         flash()->error('That series does not exist.')->important();
         return redirect('series');
     } else {
         if (!isMakerOfSeries($id, Auth::id())) {
             flash()->error('You must be logged in as the maker of this series in order to edit.')->important();
             return redirect('series/' . $id);
         } else {
             $serie = loadSerieWithIdOrTitle($id)[0];
             $type = loadType2($serie->tId)[0];
             return view('series.edit', compact('serie', 'type'));
         }
     }
 }
@extends('master')

@section('title')
    Multiple series were found
@stop

@section('content')
    <h2>Choose one of the following series:</h2>

    <ul>
        @foreach($series as $serie)
            @if( SerieContainsExercises($serie->id) or (Auth::id() === $serie->makerId) )
                <h3><a href="{{ action('SeriesController@show', [$serie->id])}}">{{$serie->title}}</a></h3>
                <ul>
                    <?php 
$type = loadType2($serie->tId)[0];
?>
                    <li>Description : {{$serie->description}}</li>
                    <li>Subject : {{$type->subject}}</li>
                    <li>Difficulty : {{$type->difficulty}}</li>
                </ul>
            @endif
        @endforeach
    </ul>

    @if ( Auth::check() )
        <h2><a href="series/create">Create new series</a></h2>
    @else
        <h2><a href="/login">User login</a></h2>
    @endif