1. Go to this page and download the library: Download thyyppa/laravel-fluent-fm 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/ */
thyyppa / laravel-fluent-fm example snippets
'providers' => [
// Other Service Providers
Hyyppa\LaravelFluentFM\Providers\LaravelFluentFMServiceProvider::class,
],
'aliases' => [
// Other Aliases
Hyyppa\LaravelFluentFM\Facades\FluentFM::class,
]
use Hyyppa\LaravelFluentFM\Facades\FluentFM;
// get a single record as array
$record = FluentFM::record('layout', 'id')->get();
// get multiple records as array
$records = FluentFM::records('layout')->limit(10)->get();
// if multiple records are matched each will be updated
FluentFM::update('customers', [ 'phone' => '406-555-0199' ])
->where('id',13)
->limit(1)
->exec();
// hard delete removes record
FluentFM::delete('customers')
->where('id',13)
->limit(1)
->exec();
// soft delete sets record's deleted_at field
FluentFM::softDelete('customers')
->where('id',13)
->limit(1)
->exec();
// undeletes soft deleted records
FluentFM::undelete('customers')
->where('id',13)
->limit(1)
->exec();
// returns matching records that have not been soft deleted
$active = FluentFM::find('customers')
->where('first','Bob')
->withoutDeleted()
->get();
// returns matching records even if soft deleted (default behavior)
$all = FluentFM::find('customers')
->where('first','Bob')
->withDeleted()
->get();
// if query matches multiple, file will be added to each
FluentFM::upload('customers', 'photo', './path/to/photo.jpg')
->where('id', 13)
->limit(1)
->exec();
// if query matches multiple, all files will be downloaded to path
FluentFM::download('customers', 'photo', './save/to/path/')
->where('id', 13)
->limit(1)
->exec();
...
->get()
->exec()
->create( <layout>, [fields] )
->latest( <layout>, [field] ) # table must have created_at field if [field] undefined
->oldest( <layout>, [field] ) # table must have created_at field if [field] undefined
->lastUpdate( <layout>, [field] ) # table must have updated_at field if [field] undefined
->first()
->last()
...
// set global fields on table
FluentFM::globals( [table], [ key => value ] )
// clear query parameters
FluentFM::clearQuery()
// clear query parameters and reset to default options
FluentFM::reset()