You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
395 B
PHTML
22 lines
395 B
PHTML
2 years ago
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers\Api;
|
||
|
|
||
|
use App\Http\Controllers\Controller;
|
||
|
use App\Models\Role;
|
||
|
use Illuminate\Http\Request;
|
||
|
|
||
|
class RoleController extends Controller
|
||
|
{
|
||
|
public function index(Request $request)
|
||
|
{
|
||
|
$query = Role::query();
|
||
|
|
||
|
if ($request->q) {
|
||
|
$query->where('name', 'like', "%{$request->q}%");
|
||
|
}
|
||
|
|
||
|
return $query->get();
|
||
|
}
|
||
|
}
|