You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
903 B
32 lines
903 B
<?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); |
|
} |
|
} |
|
}
|
|
|