1. Go to this page and download the library: Download chandra-hemant/htkc-utils library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
chandra-hemant / htkc-utils example snippets
use Illuminate\Http\Request; // Import your Eloquent model
$searchColumns = [
// Specify your searchable columns here
];
$helper = new DynamicSearchHelper(
request: $request,
searchColumns: $searchColumns,
withPagination: true,
queryMode: false,
isApi: true
);
$result = $helper->getDynamicSearchData();
// Define search value, columns, and relationships
$searchColumns = ['column1','relationshipMethod.column2','relationshipMethod1.relationshipMethod2.column3','relationshipMethod3.relationshipMethod4.relationshipMethod5.relationshipMethod6.column8'];
use Illuminate\Http\Request;
use ChandraHemant\HtkcUtils\DynamicSearchHelper;
class YourController extends Controller
{
public function index(Request $request)
{
$user = Auth::user();
$helper = new DynamicSearchHelper(
request: $request,
searchColumns: ['unique_id' => $user->unique_id], // Provide your search columns if needed
withPagination: true,
queryMode: false,
isApi: false,
);
// Get the dynamic search data
$data = $helper->getDynamicSearchData();
return view('your_view', compact('data'));
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.