return [
1 => [
'title' => 'Продукт #1',
'price' => 2000
],
...
786 => [
'title' => 'Продукт #786',
'price' => 7869
],
];
$products = require_once 'products.php';
<?php echo $products['786']['price']; ?>
class TaskType extends Model
{
public function tasks()
{
return $this->hasMany('App\Models\Task');
}
}
class Task extends Model
{
public function type() {
return $this->belongsTo('App\Models\TaskType');
}
}
jquery live search json
img {
display: block;
}
img {
display: block;
max-width: 100%;
margin-left: auto;
margin-right: auto;
}
function parseINIString(data){
var regex = {
section: /^\s*\[\s*([^\]]*)\s*\]\s*$/,
param: /^\s*([^=]+?)\s*=\s*(.*?)\s*$/,
comment: /^\s*;.*$/
};
var value = {};
var lines = data.split(/[\r\n]+/);
var section = null;
lines.forEach(function(line){
if(regex.comment.test(line)){
return;
}else if(regex.param.test(line)){
var match = line.match(regex.param);
if(section){
value[section][match[1]] = match[2];
}else{
value[match[1]] = match[2];
}
}else if(regex.section.test(line)){
var match = line.match(regex.section);
value[match[1]] = {};
section = match[1];
}else if(line.length == 0 && section){
section = null;
};
});
return value;
}
<input type="radio" name="item" checked={ checked } id="radio" />