/**
* App\Role
*
* @property int $id
* @property \Carbon\Carbon|null $created_at
* @property \Carbon\Carbon|null $updated_at
* @property string $name
* @property string $description
* @property-read \Illuminate\Database\Eloquent\Collection|\App\User[] $users
* @method static \Illuminate\Database\Eloquent\Builder|\App\Role whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Role whereDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Role whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Role whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Role whereUpdatedAt($value)
* @mixin \Eloquent
*/
<?php
$arr = [1,2,3,5,6];
$json = json_encode ( $arr, JSON_FORCE_OBJECT );
?>
<script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
var json = jQuery.parseJSON ("<?php echo $json; ?>" );
</script>
foreach ($data['books'] as $book) {
echo $book['title']. ' - ' .$data['authors'][$book['author']]['name']. ' - ' .$book['publishedAt']. '<br>';
};
foreach($posts as $k => $post){
setup_postdata($post); ?>
<div class="tab">
<input type="checkbox" id="tab{$k}" name="tab-group">
<label for="tab{$k}" class="tab-title"><?php the_field('vopros', $post->ID) ?></label>
<section class="tab-content">
<?php the_field('otvet', $post->ID) ?>
</section>
</div>
<?php }
$x="foobar http://example.com foobar s;fskdljslkjsdklf www.google.com";
$x = preg_replace("~(https?://(?:www\.)?[^\s]+)~i","<a href='$1'>$1</a>", $x);
$x = preg_replace("~(www.([^\s]+))~i", "<a href='http://$1'>$1</a>", $x);
echo $x;
$arr = array("hello" => "world", "how" => "are", "you" => "dude");
echo str_replace(["&", "?"], '', http_build_query($arr));
$arr = array ( 0 => array ( 'id' => '4', 0 => '4', 'address' => 'Гродно', 2 => 'Гродно', 'name' => 'Елена', 11 => 'Елена','distance' => '246.37229654695437', 14 => '246.37229654695437', ), 1 => array ( 'id' => '5', 0 => '5', 'address' => 'Брест', 2 => 'Брест', 'name' => 'Сергей', 11 => 'Сергей', 'distance' => '328.14766422409343', 14 => '328.14766422409343', ), 2 => array ( 'id' => '4', 0 => '4', 'address' => 'Гродно', 2 => 'Гродно', 'name' => 'Елена', 11 => 'Елена','distance' => '0', 14 => '0', ));
print_r(array_sort($arr, 'distance', SORT_DESC));
function array_sort($array, $on, $order=SORT_ASC)
{
$new_array = array();
$sortable_array = array();
if (count($array) > 0) {
foreach ($array as $k => $v) {
if (is_array($v)) {
foreach ($v as $k2 => $v2) {
if ($k2 == $on) {
$sortable_array[$k] = $v2;
}
}
} else {
$sortable_array[$k] = $v;
}
}
switch ($order) {
case SORT_ASC:
asort($sortable_array);
break;
case SORT_DESC:
arsort($sortable_array);
break;
}
foreach ($sortable_array as $k => $v) {
$new_array[$k] = $array[$k];
}
}
return $new_array;
}
public function reset(Request $request)
{
$request->validate([
'token' => 'required',
'email' => 'required|email',
'password' => 'required|confirmed|min:6',
], $this->validationErrorMessages());
// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
$this->broker()->validator(function ($credentials) {
return mb_strlen($credentials['password']) >= 6;
});
$response = $this->broker()->reset(
$this->credentials($request),
function ($user, $password) {
$this->resetPassword($user, $password);
}
);
// If the password was successfully reset, we will redirect the user back to
// the application's home authenticated view. If there is an error we can
// redirect them back to where they came from with their error message.
return $response == Password::PASSWORD_RESET
? $this->sendResetResponse($request, $response)
: $this->sendResetFailedResponse($request, $response);
}