Updated IP controller for store, update and delete

Updated IP controller for store, update and delete
This commit is contained in:
cp6 2022-02-21 14:47:36 +11:00
parent 12d52bee46
commit 226c1ed4c2

View File

@ -2,12 +2,14 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\DNS;
use App\Models\IPs; use App\Models\IPs;
use App\Models\Reseller; use App\Models\Reseller;
use App\Models\Server; use App\Models\Server;
use App\Models\Shared; use App\Models\Shared;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class IPsController extends Controller class IPsController extends Controller
{ {
@ -27,26 +29,31 @@ class IPsController extends Controller
public function store(Request $request) public function store(Request $request)
{ {
// $request->validate([
'address' => 'required|ip|min:2',
'ip_type' => 'required'
]);
$ip_id = Str::random(8);
IPs::create([
'id' => $ip_id,
'address' => $request->address,
'is_ipv4' => ($request->ip_type === 'ipv4') ? 1 : 0,
'service_id' => $request->service_id,
'active' => 1
]);
return redirect()->route('IPs.index')
->with('success', 'IP address created Successfully.');
} }
public function show($id) public function destroy(IPs $IP)
{ {
// $items = IPs::find($IP->id);
} $items->delete();
public function edit($id) return redirect()->route('IPs.index')
{ ->with('success', 'IP address was deleted Successfully.');
//
}
public function update(Request $request, $id)
{
//
}
public function destroy($id)
{
//
} }
} }