PHP code example of aurorawebsoftware / flexyfield
1. Go to this page and download the library: Download aurorawebsoftware/flexyfield 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/ */
aurorawebsoftware / flexyfield example snippets
use AuroraWebSoftware\FlexyField\Contracts\FlexyModelContract;
use AuroraWebSoftware\FlexyField\Traits\Flexy;
use Illuminate\Database\Eloquent\Model;
class Product extends Model implements FlexyModelContract {
use Flexy;
// your class implementation
}
// Find all blue products
$products = Product::where('flexy_color', 'blue')->get();
// or dynamic where
$products = Product::whereFlexyColor('blue')->get();
// Find models with multiple conditions on flexy fields
$models = Product::where('flexy_color', 'blue 1')
->where('flexy_price', '<', 100)
->where('flexy_in_stock', true)
->get();
use AuroraWebSoftware\FlexyField\Enums\FlexyFieldType;
User::setFlexyShape('username', FlexyFieldType::STRING, 1, 'exyFieldType::BOOLEAN, 3, 'bool');
$user->flexy->username = 'too_long_username_exceeding_the_limit';
$user->flexy->score = 120;
$user->flexy->banned = false;
$user->save(); // ValidationException thrown due to invalid data`
use Carbon\Carbon;
$flexyModel->flexy->event_date = Carbon::now(); // Save current date as a flexy field
$flexyModel->save();
echo $flexyModel->flexy->event_date; // Output the saved date`