public function login(Request $request)
{
if (isset($request->next)) $this->redirectTo = $request->next;
$this->validateLogin($request);
// If the class is using the ThrottlesLogins trait, we can automatically throttle
// the login attempts for this application. We'll key this by the username and
// the IP address of the client making these requests into this application.
if (method_exists($this, 'hasTooManyLoginAttempts') &&
$this->hasTooManyLoginAttempts($request)) {
$this->fireLockoutEvent($request);
return $this->sendLockoutResponse($request);
}
if ($this->attemptLogin($request)) {
return $this->sendLoginResponse($request);
}
// If the login attempt was unsuccessful we will increment the number of attempts
// to login and redirect the user back to the login form. Of course, when this
// user surpasses their maximum number of attempts they will get locked out.
$this->incrementLoginAttempts($request);
return $this->sendFailedLoginResponse($request);
}
/**
* The user has been authenticated.
*
* @param \Illuminate\Http\Request $request
* @param mixed $user
* @return mixed
*/
protected function authenticated(Request $request, $user)
{
return response([
'result' => 'success',
'value' => $user
]);
}
/**
* Get the failed login response instance.
*
* @param \Illuminate\Http\Request $request
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Illuminate\Validation\ValidationException
*/
protected function sendFailedLoginResponse(Request $request)
{
return response([
'result' => 'fail',
'value' => 'Неверный логин или пароль'
]);
}
$data['email'] = 'demo@saures.ru';
$data['password'] = 'demo';
$ch = curl_init('https://api.saures.ru/login');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$response= curl_exec($ch);
curl_close($ch);
var_dump($response);
$url = 'https://api.saures.ru/login';
$data['email'] = 'demo@saures.ru';
$data['password'] = 'demo';
$requestParams = http_build_query($data);
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => 'Content-Type: application/x-www-form-urlencoded' . PHP_EOL,
'content' => $requestParams,
),
));
$result = file_get_contents($url, false, $context);
var_dump($result);
<ul class="menu">
<li><a href="#tab1" data-toggle="modal" data-target="#myModal">О Компании</a></li>
<li><a href="#tab2" data-toggle="modal" data-target="#myModal">Доставка и оплата</a></li>
<li><a href="#tab3" data-toggle="modal" data-target="#myModal">Наши гарантии</a></li>
</ul>
<div class="modal-body">
<div id="tab1" class="tab__content">Tab1</div>
<div id="tab2" class="tab__content">Tab2</div>
<div id="tab3" class="tab__content">Tab3</div>
</div>
$(document).ready(function () {
var allBlocks = $('.tab__content');
$(document).on('click', '.menu a', function () {
var el = $(this), id = el.attr('href');
allBlocks.css('display', 'none');
$('.modal-body').find(id).css('display', 'block');
return false;
});
});
<ul class="menu">
<li><a href="#tab1" data-toggle="modal" data-target="#myModal">О Компании</a></li>
<li><a href="#tab2" data-toggle="modal" data-target="#myModal">Доставка и оплата</a></li>
<li><a href="#tab3" data-toggle="modal" data-target="#myModal">Наши гарантии</a></li>
</ul>
<div class="modal-body">
<div id="tab-content">По дефолту контент первого таба</div>
</div>
$(document).ready(function () {
var target = $('#tab-content');
$(document).on('click', '.menu a', function () {
var el = $(this), id = el.attr('href');
//тут либо get либо post
$.post('url', {'tabid': id}, function (response) {
target.html(response);
});
return false;
});
});
$(this).children().each(function (index){
if ($(this).attr('data-position') != (index+1)) {
$(this).attr('data-position', (index+1)).addClass('updated'); // подставляю класс updated если изменилась позиция
}
}).promise().done(function() {
saveNewPositions();
});