1. Go to this page and download the library: Download calebporzio/sushi 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/ */
calebporzio / sushi example snippets
class State extends Model
{
use \Sushi\Sushi;
protected $rows = [
[
'abbr' => 'NY',
'name' => 'New York',
],
[
'abbr' => 'CA',
'name' => 'California',
],
];
}
class Products extends Model
{
use \Sushi\Sushi;
protected $rows = [
['name' => 'Lawn Mower', 'price' => '226.99'],
['name' => 'Leaf Blower', 'price' => '134.99'],
['name' => 'Rake', 'price' => '9.99'],
];
protected function afterMigrate(Blueprint $table)
{
$table->index('name');
}
}
class Role extends Model
{
use \Sushi\Sushi;
public function getRows()
{
return [
['id' => 1, 'label' => 'admin'],
['id' => 2, 'label' => 'manager'],
['id' => 3, 'label' => 'user'],
];
}
}
class Role extends Model
{
use \Sushi\Sushi;
public function getRows()
{
return [
['id' => 1, 'label' => 'admin'],
['id' => 2, 'label' => 'manager'],
['id' => 3, 'label' => 'user'],
];
}
protected function sushiShouldCache()
{
return true;
}
}
class Role extends Model
{
use \Sushi\Sushi;
public function getRows()
{
return CSV::fromFile(__DIR__.'/roles.csv')->toArray();
}
protected function sushiShouldCache()
{
return true;
}
protected function sushiCacheReferencePath()
{
return __DIR__.'/roles.csv';
}
}
class Currency extends Model
{
use \Sushi\Sushi;
protected $schema = [
'id' => 'integer',
'name' => 'string',
'symbol' => 'string',
'precision' => 'float'
];
public function getRows()
{
return [];
}
}
class Role extends Model
{
use \Sushi\Sushi;
public $incrementing = false;
protected $keyType = 'string';
protected $rows = [
['id' => 'admin', 'label' => 'Admin'],
['id' => 'manager', 'label' => 'Manager'],
['id' => 'user', 'label' => 'User'],
];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.