/**
* 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
*/
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);
}
$query = Author::query();
$query->when(request('filter_by') == 'likes', function ($q) {
return $q->where('likes', '>', request('likes_amount', 0));
});
$query->when(request('filter_by') == 'date', function ($q) {
return $q->orderBy('created_at', request('ordering_rule', 'desc'));
});
$authors = $query->get();
$lang = BookLanguage::find($request->book_language_id);
$book = Book::make(['name'=>'books','ISBN'=>'123123']);
$book->language()->associate($lang);
$book->saveOrFail();
if( count(Mail::failures()) > 0 ) {
echo "There was one or more failures. They were: <br />";
foreach(Mail::failures as $email_address) {
echo " - $email_address <br />";
}
}
// check for failures
if (Mail::failures()) {
return redirect()->back()->with('status', 'Email not send');
}
// otherwise everything is okay ...
return redirect()->route('home')->with('status', 'Email is send');