Added a PeopleController.
Added a basic route to the index page of all people. Added views and controller for this purpose.
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Person;
|
||||||
|
|
||||||
|
|
||||||
|
class PeopleController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$people = Person::orderBy('name_or_company')->get();
|
||||||
|
|
||||||
|
return view('people.index', compact('people'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(Person $person)
|
||||||
|
{
|
||||||
|
return view('people.show', compact('person'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ class CreatePeopleTable extends Migration
|
|||||||
$table->string('surname')->nullable();
|
$table->string('surname')->nullable();
|
||||||
|
|
||||||
// Date of birth
|
// Date of birth
|
||||||
$table->date('date_of_birth')->nullable();
|
$table->date('date_of_birth')->nullable()->default();
|
||||||
|
|
||||||
// Adress
|
// Adress
|
||||||
$table->string('city')->nullable();
|
$table->string('city')->nullable();
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<table border='1'>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Titel</th>
|
||||||
|
<th>Name / Firma</th>
|
||||||
|
<th>Vorname</th>
|
||||||
|
<th>Straße</th>
|
||||||
|
<th>PLZ</th>
|
||||||
|
<th>Ort</th>
|
||||||
|
<th>E-Mail</th>
|
||||||
|
<th>Handy</th>
|
||||||
|
<th>Telefon</th>
|
||||||
|
<th>Aktionen</th>
|
||||||
|
</tr>
|
||||||
|
@foreach ($people as $person)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $person->id }}</td>
|
||||||
|
<td>{{ $person->title }}</td>
|
||||||
|
<td>{{ $person->name_or_company }}</td>
|
||||||
|
<td>{{ $person->surname }}</td>
|
||||||
|
<td>{{ $person->street }}</td>
|
||||||
|
<td>{{ $person->postal_code }}</td>
|
||||||
|
<td>{{ $person->city }}</td>
|
||||||
|
<td>{{ $person->email }}</td>
|
||||||
|
<td>{{ $person->mobile }}</td>
|
||||||
|
<td>{{ $person->phone }}</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</table>
|
||||||
|
|
||||||
@@ -14,3 +14,6 @@
|
|||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
return view('welcome');
|
return view('welcome');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::get('/people', 'PeopleController@index');
|
||||||
|
Route::get('/people/{person}', 'PeopleController@show');
|
||||||
|
|||||||
Reference in New Issue
Block a user