| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\App\Http\Controllers; |
| 4 |
|
| 5 |
|
| 6 |
use FluentCart\App\Models\Order; |
| 7 |
use FluentCart\Framework\Http\Request\Request; |
| 8 |
|
| 9 |
class NotesController extends Controller |
| 10 |
{ |
| 11 |
public function attach(Request $request) |
| 12 |
{ |
| 13 |
$order = Order::query()->findOrFail( |
| 14 |
sanitize_text_field($request->get('order_id')) |
| 15 |
); |
| 16 |
|
| 17 |
$order->note = sanitize_text_field($request->get('note')); |
| 18 |
|
| 19 |
|
| 20 |
if ($order->update()) { |
| 21 |
return $this->sendSuccess([ |
| 22 |
'message' => __('Order Note Updated successfully.', 'fluent-cart'), |
| 23 |
]); |
| 24 |
} |
| 25 |
return $this->sendError([ |
| 26 |
'message' => __('Failed to update order note.', 'fluent-cart'), |
| 27 |
]); |
| 28 |
} |
| 29 |
} |
| 30 |
|