my first commit
This commit is contained in:
30
app/Http/Controllers/CloudServiceController.php
Normal file
30
app/Http/Controllers/CloudServiceController.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\CloudService;
|
||||
|
||||
class CloudServiceController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$cloudServices = CloudService::all();
|
||||
// return view('cloudServices.index', compact('cloudServices'));
|
||||
return response()->json($cloudServices);
|
||||
}
|
||||
|
||||
public function create(Request $request)
|
||||
{
|
||||
$name = $request->get('name');
|
||||
$cloudService = new CloudService();
|
||||
$cloudService->name = $name;
|
||||
$cloudService->save();
|
||||
// $cloudService = CloudService::create([
|
||||
// 'name' => $name
|
||||
// ]);
|
||||
|
||||
return response()->json($cloudService->toJson());
|
||||
}
|
||||
|
||||
}
|
||||
8
app/Http/Controllers/Controller.php
Normal file
8
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
Reference in New Issue
Block a user