Fixed contacts
This commit is contained in:
parent
6979d0c0b4
commit
0c8cad9668
|
@ -13,6 +13,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
class Contact extends Model
|
class Contact extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name_first', "name_last", 'email', 'phone'
|
'contactname', "title", 'email', 'phone'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,8 @@ class ContactController extends Controller
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$requestContact = $request->validate([
|
$requestContact = $request->validate([
|
||||||
"name_first" => "required|max:255",
|
"contactname" => "required|max:255",
|
||||||
"name_last" => "required|max:255",
|
"title" => "required|max:255",
|
||||||
"email" => "required|max:255",
|
"email" => "required|max:255",
|
||||||
"phone" => "required|max:255",
|
"phone" => "required|max:255",
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -16,8 +16,8 @@ class CreateContact extends Migration
|
||||||
Schema::create('contacts', function (Blueprint $table) {
|
Schema::create('contacts', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->string('name_first', 255);
|
$table->string('contactname', 255);
|
||||||
$table->string('name_last', 255);
|
$table->string('title', 255);
|
||||||
$table->string('email', 255);
|
$table->string('email', 255);
|
||||||
$table->integer('phone');
|
$table->integer('phone');
|
||||||
//$table->unique('email');
|
//$table->unique('email');
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
<h1>Opret Kontakt:</h1>
|
<h1>Opret Kontakt:</h1>
|
||||||
<form method="post" action="{{ route("contacts.store") }}">
|
<form method="post" action="{{ route("contacts.store") }}">
|
||||||
@csrf
|
@csrf
|
||||||
<label for="name_first">Fornavn:</label>
|
<label for="contactname">Kontakt Navn:</label>
|
||||||
<input type="text" name="name_first" id="name_first" placeholder="Fornavn" required>
|
<input type="text" name="contactname" id="contactname" placeholder="Navn" required>
|
||||||
<label for="name_last">Efternavn:</label>
|
<label for="title">Titel:</label>
|
||||||
<input type="text" name="name_last" id="name_last" placeholder="Efternavn" required>
|
<input type="text" name="title" id="title" placeholder="Titel" required>
|
||||||
<label for="email">Email:</label>
|
<label for="email">Email:</label>
|
||||||
<input type="email" name="email" id="email" placeholder="x@y.z" required>
|
<input type="email" name="email" id="email" placeholder="x@y.z" required>
|
||||||
<label for="tel">Telefon nr:</label>
|
<label for="tel">Telefon nr:</label>
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
<form method="post" action="{{ route("contacts.update", ['contact' => $contact]) }}">
|
<form method="post" action="{{ route("contacts.update", ['contact' => $contact]) }}">
|
||||||
@csrf
|
@csrf
|
||||||
@method("put")
|
@method("put")
|
||||||
<label for="name_first">Fornavn:</label>
|
<label for="contactname">Kontakt Navn:</label>
|
||||||
<input type="text" name="name_first" id="name_first" placeholder="Fornavn" value="{{ $contact->name_first }}" required>
|
<input type="text" name="contactname" id="contactname" placeholder="Navn" value="{{ $contact->contactname }}" required>
|
||||||
<label for="name_last">Efternavn:</label>
|
<label for="title">Titel:</label>
|
||||||
<input type="text" name="name_last" id="name_last" placeholder="Efternavn" value="{{ $contact->name_last }}" required>
|
<input type="text" name="title" id="title" placeholder="Titel" value="{{ $contact->title }}" required>
|
||||||
<label for="email">Email:</label>
|
<label for="email">Email:</label>
|
||||||
<input type="email" name="email" id="email" placeholder="x@y.z" value="{{ $contact->email }}" required>
|
<input type="email" name="email" id="email" placeholder="x@y.z" value="{{ $contact->email }}" required>
|
||||||
<label for="tel">Telefon nr:</label>
|
<label for="tel">Telefon nr:</label>
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
</tr>
|
</tr>
|
||||||
@foreach($contacts as $contact)
|
@foreach($contacts as $contact)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $contact->name_first }}</td>
|
<td>{{ $contact->contactname }}</td>
|
||||||
<td>{{ $contact->name_last }}</td>
|
<td>{{ $contact->title }}</td>
|
||||||
<td>{{ $contact->email }}</td>
|
<td>{{ $contact->email }}</td>
|
||||||
<td>{{ $contact->phone }}</td>
|
<td>{{ $contact->phone }}</td>
|
||||||
<td><a href="{{ route("contacts.edit", [ "contact" => $contact ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
|
<td><a href="{{ route("contacts.edit", [ "contact" => $contact ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
|
||||||
|
|
Loading…
Reference in New Issue