PHP code example of ismailelbery / laravel-arabic-search
1. Go to this page and download the library: Download ismailelbery/laravel-arabic-search 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/ */
ismailelbery / laravel-arabic-search example snippets
use IsmailElbery\ArabicSearch\Concerns\HasArabicSearch;
class Article extends Model
{
use HasArabicSearch;
protected array $arabicSearchable = ['title', 'body'];
}
use IsmailElbery\ArabicSearch\Facades\ArabicSearch;
ArabicSearch::normalize('مُحَمَّدٌ'); // "محمد"
ArabicSearch::tokenize('بسم الله الرحمن'); // ["بسم","الله","الرحمن"]
User::whereArabicVariants('name', 'اسلام')->paginate();
DB::table('users')->whereArabicVariants('name', 'اسلام')->get();
// Two (or more) columns — OR-ed together:
User::whereArabicVariants(['first_name', 'last_name'], 'اسلام')->get();
// Composes with other conditions:
DB::table('docs')->where('pinned', true)
->orWhereArabicVariants('title', 'اسلام')->get();