55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php namespace AhmadFatoni\ApiGenerator\Controllers\API;
|
|
|
|
use Cms\Classes\Controller;
|
|
use BackendMenu;
|
|
|
|
use Illuminate\Http\Request;
|
|
use AhmadFatoni\ApiGenerator\Helpers\Helpers;
|
|
use Illuminate\Support\Facades\Validator;
|
|
use Sms\Sms\Models\SmsSender;
|
|
|
|
class SmsApiController extends Controller
|
|
{
|
|
protected $SmsSender;
|
|
|
|
protected $helpers;
|
|
|
|
public function __construct(SmsSender $SmsSender, Helpers $helpers)
|
|
{
|
|
parent::__construct();
|
|
$this->SmsSender = $SmsSender;
|
|
$this->helpers = $helpers;
|
|
}
|
|
|
|
public function index(){
|
|
|
|
$otps = SmsSender::where('status', false)->get();
|
|
$answer = [];
|
|
|
|
foreach ($otps as $item) {
|
|
$answer[] = ["phone_number" => (string)$item->phone, "body" => (string) $item->message];
|
|
$item->status = true;
|
|
$item->save();
|
|
}
|
|
|
|
$data = [
|
|
"error"=> null,
|
|
"message"=> "OK",
|
|
"status" => 200,
|
|
"category"=> null,
|
|
"data" => $answer
|
|
];
|
|
|
|
return response()->json($data, 200);
|
|
|
|
}
|
|
|
|
|
|
public static function getAfterFilters() {return [];}
|
|
public static function getBeforeFilters() {return [];}
|
|
public static function getMiddleware() {return [];}
|
|
public function callAction($method, $parameters=false) {
|
|
return call_user_func_array(array($this, $method), $parameters);
|
|
}
|
|
|
|
} |