redirect if no locations

This commit is contained in:
Dane Everitt 2016-09-30 16:05:39 -04:00
parent 2e88c51ac7
commit 16222d1bd7
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 6 additions and 0 deletions

View file

@ -65,6 +65,11 @@ class NodesController extends Controller
public function getNew(Request $request)
{
if (!Models\Location::all()->count()) {
Alert::warning('You must add a location before you can add a new node.')->flash();
return redirect()->route('admin.locations');
}
return view('admin.nodes.new', [
'locations' => Models\Location::all()
]);