ok
This commit is contained in:
44
app/Http/Controllers/Api/ContactUsController.php
Normal file
44
app/Http/Controllers/Api/ContactUsController.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\CMS\ContactUs;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class ContactUsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Store contact us message
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
/**
|
||||
* Message Title
|
||||
*
|
||||
* @example Salam
|
||||
*/
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Message content
|
||||
*
|
||||
* @example Bet app
|
||||
*/
|
||||
'message' => ['required', 'string', 'max:255'],
|
||||
]);
|
||||
|
||||
ContactUs::forceCreate(
|
||||
...$data,
|
||||
...[
|
||||
'user_id' => auth()->id(),
|
||||
],
|
||||
);
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully created'),
|
||||
], 201);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user