Skip to content
Snippets Groups Projects
Commit 960af43f authored by Thibault Debatty's avatar Thibault Debatty
Browse files

preserve organization when we update a server

parent 45724bde
No related branches found
No related tags found
No related merge requests found
Pipeline #13796 failed
......@@ -32,7 +32,10 @@ class ServerController extends Controller
public function create()
{
$this->authorize("create", Server::class);
return view("server.edit", ["server" => new Server()]);
$server = new Server();
$server->organization = Auth::user()->organizations->first();
return view("server.edit", ["server" => $server]);
}
/**
......
......@@ -26,8 +26,9 @@
class="form-control{{ $errors->has('organization_id') ? ' is-invalid' : '' }}"
name="organization_id"
required autofocus>
<option value="{{ $server->organization->id }}">{{ $server->organization->name }}</option>
@foreach (Auth::user()->organizations as $organization)
<option value="{{ $organization->id }}" {{ old('organization_id', $server->organization_id) == $organization->id ? "selected" : "" }}">{{ $organization->name }}</option>
<option value="{{ $organization->id }}">{{ $organization->name }}</option>
@endforeach
</select>
......@@ -64,6 +65,7 @@
<textarea id="description"
class="form-control{{ $errors->has('description') ? ' is-invalid' : '' }}"
name="description"
placeholder="You can use Markdown here..."
rows="10">{{ old('description', $server->description) }}</textarea>
@if ($errors->has('description'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment