Skip to content

Commit

Permalink
priprava na editaci osoby
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiří Lýsek committed Mar 2, 2017
1 parent b4e603f commit d57b008
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/Http/Controllers/PersonsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,11 @@ function insert(Request $r) {
return redirect(route('person::list'))->with('successful_insert', true);
}

function edit(Request $r, $id) {
return view("persons/edit");
}

function update(Request $r, $id) {
}

}
6 changes: 6 additions & 0 deletions resources/views/persons/edit.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@extends('layout')

@section('title', 'Editace osoby')

@section('content')
@endsection
4 changes: 4 additions & 0 deletions resources/views/persons/list.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<tr>
<th>Jméno</th>
<th>Adresa</th>
<th>Editovat</th>
<th>Smazat</th>
</tr>
@foreach($persons as $person)
Expand All @@ -30,6 +31,9 @@
@else
<td>Nema adresu</td>
@endif
<td>
<a href="{{route('person::edit', ['id' => $person->id])}}" class="btn btn-primary">Editace</a>
</td>
<td>
<form action="{{route('person::delete', ['id' => $person->id])}}" method="post" onsubmit="return confirm('Opravdu smazat?')">
{{ csrf_field() }}
Expand Down
3 changes: 3 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@

Route::get('/osoby/vytvorit', 'PersonsList@create')->name('person::create');
Route::post('/osoby/pridat', 'PersonsList@insert')->name('person::insert');

Route::get('/osoby/editace/{id}', 'PersonsList@edit')->name('person::edit');
Route::post('/osoby/ulozit/{id}', 'PersonsList@update')->name('person::update');
});

0 comments on commit d57b008

Please sign in to comment.