Skip to content
This repository has been archived by the owner on Sep 10, 2020. It is now read-only.

Commit

Permalink
Merge pull request #57 from InteNs/feature/entry-as-list
Browse files Browse the repository at this point in the history
Entry as list to activity
  • Loading branch information
InteNs authored May 31, 2017
2 parents ed1fccd + 0ff26a4 commit 7b75d3f
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/Http/Controllers/Admin/ActivityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
namespace App\Http\Controllers\Admin;

use App\Category;
use App\Entry;
use App\Http\Requests\StoreActivity;
use App\Activity;
use App\Http\Controllers\Controller;
use DateTime;
use PhpParser\Node\Expr\Array_;
use Session;
use Illuminate\Support\Facades\Input;
use Request;
Expand Down Expand Up @@ -80,8 +82,15 @@ public function store(StoreActivity $request)
*/
public function show($id)
{
$entries = Entry::all();
foreach ($entries as $entry) {
if ($entry->activity_id != $id) {
$entries = $entry.array_pop($entries);
}
}

return View('admin.activity.show', [
'activity' => Activity::find($id)
'activity' => Activity::find($id), 'entries' => $entries
]);
}

Expand Down
28 changes: 28 additions & 0 deletions app/Http/Controllers/Admin/EntryController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace App\Http\Controllers\Admin;

use App\Category;
use App\Entry;
use App\Http\Requests\StoreActivity;
use App\Activity;
use App\Http\Controllers\Controller;
use DateTime;
use PhpParser\Node\Expr\Array_;
use Session;
use Illuminate\Support\Facades\Input;
use Request;

class EntryController extends Controller
{
/**
* Remove the specified resource from storage.
*
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
Entry::destroy($id);
return redirect('/beheer/activiteit');
}
}
28 changes: 28 additions & 0 deletions resources/views/admin/activity/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,33 @@
<img src="{{$activity->image}}" class="img-responsive">
</div>
</div>

<table class="table table-striped table-hover ">
<tr>
<td>#</td>
<td>Voornaam</td>
<td>Achternaam</td>
<td>Telefoonnummer</td>
<td>E-mailadres</td>
<td></td>
</tr>
@foreach ($entries as $entry)
<tr>
<td>{{$entry->id}}</td>
<td>{{$entry->firstname}}</td>
<td>{{$entry->lastname}}</td>
<td>{{$entry->phone}}</td>
<td>{{$entry->email}}</td>
<td>
{{ Form::open(['id' => 'formDelete'.$entry->id,'method' => 'DELETE', 'route' => ['entry.destroy', $entry->id]]) }}
<a title="Delete" href="javascript:void(0)" onclick="document.getElementById('formDelete{{$entry->id}}').submit()">
<i class="fa fa-times" aria-hidden="true"></i>
</a>
{{ Form::close() }}
</td>
</tr>
@endforeach
</table>

</div>
@endsection
1 change: 1 addition & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
});

Route::resource('activiteit', 'Admin\ActivityController');
Route::resource('entry', 'Admin\EntryController');
Route::resource('gebruiker', 'Admin\UserController');
Route::resource('partner', 'Admin\PartnerController');
Route::resource('sponsor', 'Admin\SponsorController');
Expand Down

0 comments on commit 7b75d3f

Please sign in to comment.