Browse Source

update conflict

pull/1/head
wahyun 10 months ago
parent
commit
5e0e4ad0f6
  1. 4
      app/Http/Controllers/DemoController.php
  2. 32
      app/Http/Controllers/ScheduleDemoController.php
  3. 2
      routes/web.php

4
app/Http/Controllers/DemoController.php

@ -12,8 +12,10 @@ class DemoController extends Controller
$this->validate($request, [ $this->validate($request, [
'name' => 'required', 'name' => 'required',
'role' => 'required', 'role' => 'required',
'email' => 'required',
'number_phone' => 'required', 'number_phone' => 'required',
'message' => 'required', 'status' => 'required',
'message' => 'required'
]); ]);
$data = $request->all(); $data = $request->all();

32
app/Http/Controllers/ScheduleDemoController.php

@ -1,32 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Models\Demo;
use Illuminate\Http\Request;
class ScheduleDemoController extends Controller
{
public function add(Request $request)
{
$this->validate($request, [
'name' => 'required',
'role' => 'required',
'email' => 'required',
'number_phone' => 'required',
'status' => 'required',
'message' => 'required'
]);
$data = $request->all();
$data['created_by'] = $this->currentName;
$result = Demo::create($data);
if ($result) {
return response()->json(['status' => 'success','data' => $result, 'message' => 'add schedule successfully!', 'code' => 200], 200);
} else {
return response()->json(['status' => 'failed', 'message' => 'add data schedule failed!', 'code' => 400], 400);
}
}
}

2
routes/web.php

@ -12,7 +12,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->post('/company-management-user/search', 'CompanyController@search'); $router->post('/company-management-user/search', 'CompanyController@search');
$router->post('/human-resource-user/add', 'HumanResourceController@add_user'); $router->post('/human-resource-user/add', 'HumanResourceController@add_user');
$router->get('/company-management-user/edit/{id}', 'CompanyController@edit'); $router->get('/company-management-user/edit/{id}', 'CompanyController@edit');
$router->post('/schedule-demo/add','ScheduleDemoController@add'); $router->post('/demo-management-user/add', 'DemoController@add');
$router->post('/menu/add', 'MenuController@add'); $router->post('/menu/add', 'MenuController@add');
$router->get('/menu/edit/{id}', 'MenuController@edit'); $router->get('/menu/edit/{id}', 'MenuController@edit');

Loading…
Cancel
Save