1. Go to this page and download the library: Download hammerstone/refine-nova 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/ */
hammerstone / refine-nova example snippets
// Create a filter called "UserFilter"
class UserFilter extends Filter
{
public function conditions()
{
return [
// Number condition on the ID column
NumericCondition::make('id', 'ID'),
// Text condition on the name column
TextCondition::make('name', 'Name'),
// Boolean condition on the is_subscriber column
BooleanCondition::make('is_subscriber', 'Subscriber'),
// Option condition on the referral column
OptionCondition::make('referral', 'Referral Source')
->options([
'twitter' => 'Twitter',
'linkedin' => 'LinkedIn',
'fb' => 'Facebook'
]),
// Date condition on the created_at column
DateWithTimeCondition::make('created_at', 'Created At'),
];
}
}
namespace App\Filters;
use Hammerstone\Refine\Conditions\NumericCondition;
use Hammerstone\Refine\Filter;
class UserFilter extends Filter
{
public function conditions()
{
return [
NumericCondition::make('id', 'ID'),
// @TODO: Add more conditions
];
}
}
use App\Filters\UserFilter;
use Hammerstone\Refine\Nova\RefinesModels;
class User extends Resource
{
use RefinesModels;
// ...
public static $filter = UserFilter::class;
}
public function cards(Request $request)
{
return [
static::refineCard()
];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.