wahyun
10 months ago
3 changed files with 4 additions and 34 deletions
@ -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); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue