Answer the question
In order to leave comments, you need to log in
Where are the fields when creating a new object?
I want to do like this:
$company = new Company;
$company['country_id'] = (new Country)->getId('russia');
return response()->json($company);
$company = new Company;
$company['name'] = null;
$company['website'] = null;
$company['country_id'] = (new Country)->getId('russia');
$company['city_id'] = null;
$company['other_country'] = null;
$company['other_code'] = null;
$company['other_city'] = null;
$company['address'] = null;
$company['phone'] = null;
return response()->json($company);
Answer the question
In order to leave comments, you need to log in
$handle = fopen($dir . $minus, 'r');
while (($res = fgets($handle)) != FALSE) {
if ($res != 0) {
$array_minus[trim($res)] = true; // <- this
} else {
break;
}
}
fclose($handle);
// сравнение
foreach ($array_source as $value) {
if (!isset($array_minus[$value])) { // <- this
$array_result[] = $value;
}
}
file_put_contents("result.txt", implode(PHP_EOL, $array_result));
No way. This is php you need either something like HHVM or php7 or another programming language
the fields of the object "name" and others are implemented through magic, and in fact the object does not have them.
why don't you use$company->toJson();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question