Repo for the search and displace core module including the interface to select files and search and displace operations to run on them. https://searchanddisplace.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

77 lines
1.8 KiB

<?php
namespace App\Http\Controllers;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Http\JsonResponse;
class FilterController extends Controller
{
public static array $filters = [
'phone_number' => [
'display_name' => 'Phone number',
'options' => [
[
'name' => 'Replace with',
'type' => 'select',
'values' => [
'#', '*', 'x'
]
]
]
],
'email' => [
'display_name' => 'Email',
'options' => [
[
'name' => 'Replace with',
'type' => 'select',
'values' => [
'#', '*', 'x'
]
],
[
'name' => 'Include domain',
'type' => 'switch'
]
]
]
];
/**
* Create a new filter
*
* @return JsonResponse
*
* @throws BindingResolutionException
*/
public function create(): JsonResponse
{
return response()->json([
'result' => 'success'
]);
}
/**
* Get one or all the filters we have
*
* @param string|null $id The ID of the filter. Null if we want all of them
*
* @return JsonResponse
*
* @throws BindingResolutionException
*/
public function get(string $id = null): JsonResponse
{
if ($id === null) {
return response()->json(static::$filters);
}
if (!empty(static::$filters[$id])) {
return response()-> json(static::$filters[$id]);
}
abort(404);
}
}