1
0
mirror of https://github.com/cydrobolt/polr.git synced 2024-11-15 06:32:30 +01:00
polr/app/Http/Controllers/AjaxController.php

28 lines
691 B
PHP
Raw Normal View History

2015-11-07 02:25:48 +01:00
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Helpers\LinkHelper;
class AjaxController extends Controller {
/**
* Process non-admin AJAX requests.
*
* @return Response
*/
public function checkLinkAvailability(Request $request) {
$link_ending = $request->input('link_ending');
$ending_conforms = LinkHelper::validateEnding($link_ending);
if (!$ending_conforms) {
return "invalid";
}
else if (LinkHelper::linkExists($link_ending)) {
// if ending already exists
return "unavailable";
}
else {
return "available";
}
}
}