/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Blacklist::destroy($id);
     return redirect('/callback/blacklist');
 }
Example #2
0
        $emails = json_decode($client->settings->emails);
        $message->to($emails, 'Callcenter №1')->subject('Call-центр №1');
    });
    return response()->json(["success" => "y"])->header('Access-Control-Allow-Origin', '*');
});
/**
 * Форма в CRM
 **/
Route::get('formback', function () {
    $key = Request::input('key', null);
    if (is_null($key)) {
        return response()->json(['error' => 1, 'message' => 'Key not found'])->header('Access-Control-Allow-Origin', '*');
    }
    $client = \App\ACME\Model\Callback\Client::where('key', '=', $key)->first();
    $phone = trim(Request::input('phone'));
    $blacklists = \App\ACME\Model\Callback\Blacklist::where('phone', '=', $phone)->get()->count();
    if ($blacklists > 0) {
        return response()->json(['error' => 1, 'message' => 'You are on blacklist'])->header('Access-Control-Allow-Origin', '*');
    }
    $time = Request::input('time');
    $timeSelect = array(1 => "9:00-12:00", 2 => "12:00-16:00", 3 => "16:00-19:00", 4 => "19:00-21:00");
    $result = new stdClass();
    $result->error = 0;
    $out = App\ACME\Helpers\CRMHelper::sendClaim(445, 12, 2, ["comment" => $timeSelect[$time], "fio" => $client->title, "phone" => $phone]);
    if ($out != '0') {
        $result->id = $out;
        return response()->json($result)->header('Access-Control-Allow-Origin', '*');
    } else {
        $result->error = 1;
        return response()->json($result)->header('Access-Control-Allow-Origin', '*');
    }