public function delete(User $user, Menu $menu) {
return $user->can('delete', $menu);
}
DB::listen(function($query) {
Log::info(
$query->sql,
$query->bindings,
$query->time
);
});
/**
* Retrieve the child model query for a bound value.
*
* @param string $childType
* @param mixed $value
* @param string|null $field
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
protected function resolveChildRouteBindingQuery($childType, $value, $field)
{
$relationship = $this->{Str::plural(Str::camel($childType))}();
$field = $field ?: $relationship->getRelated()->getRouteKeyName();
if ($relationship instanceof HasManyThrough ||
$relationship instanceof BelongsToMany) {
$field = $relationship->getRelated()->getTable().'.'.$field;
}
return $relationship instanceof Model
? $relationship->resolveRouteBindingQuery($relationship, $value, $field)
: $relationship->getRelated()->resolveRouteBindingQuery($relationship, $value, $field);
}
/**
* Retrieve the child model for a bound value.
*
* @param string $childType
* @param mixed $value
* @param string|null $field
* @return \Illuminate\Database\Eloquent\Model|null
*/
public function resolveChildRouteBinding($childType, $value, $field)
{
//Смотрим что нам прилетело - и возвращаем запрос
}
<?php
$accountName = 'zero-ninja';
$secretKey = 'LiJL3dn2rm0acEVfJsRGHKY0IJvvh0QmBRjwsaPfootefwDkD4yzRNJNZaf0cPItl25xQtUVAfHEH6rcWWc4tRkoTSELR7OtJN8JY4UHi9zlJFlAKcunwDUdrSGqkvJr';
$user = [];
$user['user']['email'] = 'test@testme.ru';
$user['user']['phone'] = '+74951234567';
$user['user']['first_name'] = 'Василий';
$user['user']['last_name'] = 'Пупкин';
$user['user']['city'] = 'Москва';
$user['user']['country'] = 'Россия';
$user['user']['group_name'] = ['Группа1', 'Группа2'];
$user['system']['refresh_if_exists'] = 1;
$json = json_encode($user);
$base64 = base64_encode($json);
if( $curl = curl_init() ) {
curl_setopt($curl, CURLOPT_URL, 'https://' . $accountName . '.getcourse.ru/pl/api/users');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json'));
curl_setopt($curl, CURLOPT_VERBOSE,true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, 'action=add&key=' . $secretKey . '¶ms=' . $base64);
$out = curl_exec($curl);
echo $out;
curl_close($curl);
} else {
echo 'Failed initialization';
}
curl -i -H "Accept: application/json; q=1.0, */*; q=0.1" "https://zero-ninja.getcourse.ru/pl/api/users" -d "action=add&key={secret_key}¶ms=CgkJewoJCQkidXNlciI6ewogICAgImVtYWlsIjoidGVzdEB0ZXN0LW1haWwuY29tIiwKCQkJCSJwaG9uZSI6Iis3OTk5OTk5LTk5LTk5IiwKCQkJCSJmaXJzdF9uYW1lIjoi0JjQstCw0L0iLAoJCQkJImxhc3RfbmFtZSI6ItCY0LLQsNC90L7QsiIsCgkJCQkiY2l0eSI6ItCY0LLQsNC90L7QstC+IiwKCQkJCSJjb3VudHJ5Ijoi0KDQvtGB0YHQuNGPIgoJCQl9LAoJCQkic3lzdGVtIjp7CiAgICAgICAgICAgICAgICAicmVmcmVzaF9pZl9leGlzdHMiOjEKCQkJfQoJCX0="