text:
Can't catch exception in middleware

I want a middleware package to catch an exception in its middleware.

Exception: FormValidationException

Thrown by a validator helper, or app logic, in the controller

Middleware: HandleFormValidation

Catches only that exception and does a redirect with data & errors etc

But the exception can't be caught by the middleware, because it's already been caught and handled somewhere else. The $response object ($next() return value) is an exception error page.
Who catches my exception, and where, and why so early? Aren't exceptions allowed in the middleware pipeline?
The app can extend its App\Exceptions\Handler to 'render' that exception into a redirect, but I want all logic to be in the package, not just half.
Middleware looks like this:
public function handle(Request $request, Closure $next) {
  try {
    return $next($request); // Passes through an uncaught exception error page
  }
  catch (\Exception $ex) {
    exit(__METHOD__); // Never gets here
  }
}

Yes, this is the beavhiour starting from L5.2. Throwing an exception causes the response to be set as that returned from the exception handler, and then the middleware is allowed to backout from that point.

Back out from that point how? Where is my exception? How can non-app code do something with specific exceptions? Do I really extract it from the response object? That seems silly...

We don't recommend you write try catch blocks in middleware. Instead, handle exceptions inside the exception handler. Perhaps https://github.com/GrahamCampbell/Laravel-Exceptions would be of use to you?

Yeah, I don't like that, because only 1 party can extend a base class. What if 4 packages want specific exception handling? That's why middleware is perfect.
This does the trick, but it feels really funky:
public function handle(Request $request, Closure $next) {
  $response = $next($request);

  // 'Catch' our FormValidationException and redirect back.
  if (!empty($response->exception) && $response->exception instanceof FormValidationException) {
    return redirect()->back()->withErrors($response->exception->form->getErrors())->withInput();
  }

  return $response;
}

Is that what you recommend? It can't be in App\Exceptions\Handler, because that's app logic.
Thanks for super fast replies!
I'm still curious how this handling works though. I was trying to debug the middleware pipeline, but I couldn't find any exception catching. I really thought my middleware was the first to catch it. Where does that happen?

I guess it would be conventional for the application to still handle package exceptions. Feel free to ask around on the forums for solutions other people might have.
In terms of where does this happen, it happens in our pipeline. Starting with L5.2, there's a custom http pipeline: https://github.com/laravel/framework/blob/5.2/src/Illuminate/Routing/Pipeline.php.

Your observation about accessing the exception on the response could be useful for package exception handling, but I can't say it's something I've had to do before (hence why I'd recommend asking on the forums to find someone who might have tried to do this).

What a crappy framework!!!

Hi! The correct way is don't catch errors directly on middleware. You need add a custom ExceptionHandler. If you like register handler on your middleware, you can do it.
How catch errors without touching App\Exceptions\Handler file:
Register your CustomExceptionHandler
    /* @var ExceptionHandler Illuminate\Contracts\Debug\ExceptionHandler */
    $previousHandler = null;
    if (app()->bound(ExceptionHandler::class) === true) {
        $previousHandler = app()->make(ExceptionHandler::class);
    }
    app()->singleton(ExceptionHandler::class, function () use ($previousHandler) {
        return new CustomExceptionHandler($previousHandler);
    });

And your basic CustomExceptionHandler
    class CustomExceptionHandler implements ExceptionHandlerInterface
    {
        /**
         * @var ExceptionHandlerInterface|null
         */
        private $previous;

        public function __construct(ExceptionHandlerInterface $previous = null)
        {
            $this->previous = $previous;
        }

        public function report(Exception $exception)
        {
            $this->previous === null ?: $this->previous->report($exception);
        }

        public function render($request, Exception $exception)
        {
            if ($exception instanceof CustomExceptionHandler) {
                echo 'This is my particular way to show my errors';
            } else {
                $response = $this->previous === null ? null : $this->previous->render($request, $exception);
            }

            return $response;
        }

        /**
         * {@inheritdoc}
         */
        public function renderForConsole($output, Exception $exception)
        {
            /* @var OutputInterface $output */
            $this->previous === null ?: $this->previous->renderForConsole($output, $exception);
        }
    }

I'm pretty sure Barryvdh\Debugbar does something like this.  I just encountered a scenario where a middleware was bombing out, and failing quietly.  No errors in the log, and only a vague 500 error response.  Then I noticed that only Debugbar was detecting what was actually wrong.
It looks like the package includes its own Middleware\Debugbar class designed to handle middleware exceptions, a similar tactic to what @pablorsk was describing.  I'm dissecting it at the moment to see if it can offer any clues to how I might write my own handler that can exist outside of debug-mode.  I've gotten as far as identifying the try/catch in Debugbar::handle as a red herring.  That middleware exceptions end up in the $response->exceptions, as stated earlier, though I'm not certain how yet.  They begin getting handled in Barryvdh\Debugbar\LaravelDebugbar::modifyResponse().
Beyond that, tracing gets a little tricky, since the data gets buried in associative arrays and inherited class properties, rather than method responses.  But I still have hope that the answer is in here somewhere.  @rudiedirkx, it sounds like this might be what you're looking for.

What about the situation, when some small part of application goes through this middleware and I don't wan't to handle it global handler? Is it possible to disable this pipeline?

@warlof - Well you don't have to register all middleware in the Kernel.  You could apply it with the Illuminate\Routing\Controller::middleware() method, meaning you could wrap some logic around when to apply it.  You could also manage the behavior therein with some configuration variables, maybe derived from environment ones, and even alter those config values within your app (though that feels a little sloppy).
There's also a 'middleware.disable' flag that you can leverage, but that's kind of all-or-nothing thing, usually used for unit tests.  I'm not entirely certain how to use it outside of the PhpUnit WithoutMiddleware trait, but you could take a look at how that works, and the Illuminate\Routing\Router::runRouteWithinStack() method that actually looks at the flag.
You might also consider writing an override for the Illuminate\Routing\Router::gatherRouteMiddleware() method.  Maybe something that could look to a config array of 'allowable' middlewares, as it compiles what ones are assigned to the given route.

I'm developing a package for user tracking. Its called from a middleware, but if anything fails, I want to just log the error and go further, that the user doesn't recognize anything about that, because it's not app critical. I want to do that in the package itself, not in the application. Isn't that possible to achieve?

The trouble is, I think Middleware follows the Chain of Responsibility pattern, similar to a Handler-Stack, by way of a series of nested Closures.  I'm not really sure how to interrupt that flow, given that you can't exactly write an override class for a Closure that could try-catch the error, and more importantly, have an awareness of what the next link in the chain is.  Middleware classes don't extend a common base-class for you to leverage either.  So the only thing I could think of would be to take a step further back from that, to how Middleware gets stored and executed in the first place.  Have something that wraps each closure in a closure of your own that's designed to handle the errors and then move on to the next one.
Current flow:

|Middleware Closure| -> |Middleware Closure|
||      ||
Your flow:

|Your Error-Handling Closure| -> |Your Error-Handling Closure|
|  ______________________           |      |  ______________________           |
|  |Middleware Closure|          |      |  |Middleware Closure|          |
|  ||          |      |  ||          |
||      ||
I'm not really sure where what class you'd have to override to do this.  I think I'd start by dissecting the Kernel, or using debug_backtrace inside of one of the Middleware classes to see what fires it.

@ivorobioff I will be happy to work with your "not crappy" framework anytime soon

Developers should not be expected to work outside standards to handle catch issues in when using a standard try catch...  I spent hours looking for why this didn't work as expected.

@Cleanshooter While it's not possible to use try / catch in a middleware, it's indeed possible to dictate the response with throwing an exception or using the abort() helper:
    public function handle($request, Closure $next)
    {
        if(! $notAuthenticated){
            throw new AuthenticationException();
            // or something like:
            abort('401', 'Expired Token');
        }
    }

@Cleanshooter While it's not possible to use try / catch in a middleware, it's indeed possible to dictate the response with throwing an exception or using the abort() helper:
    public function handle($request, Closure $next)
    {
        if(! $notAuthenticated){
            throw new AuthenticationException();
            // or something like:
            abort('401', 'Expired Token');
        }
    }

@ndberg Thank you for this, I will give it a try.  Beyond the documentation here: https://laravel.com/docs/6.x/middleware where would I have found this helper function?  I looked for quite a while for this yesterday but couldn't find what interfaces/methods are available for middleware.

Here you go https://laravel.com/docs/6.x/helpers

Here you go https://laravel.com/docs/6.x/helpers

Thanks for this but this just begs the question, "Why when I used the response() helper in the middleware did it not work."  Using 6.9, I tried to use (multiple variations of) response('UNAUTHORIZED', 401);.  No matter what I did, however my ngrok reported returning an OK, 200.
How are we as developers using the framework to discern which helpers work for which implementation (controler, middleware, model, view, ect.) if they are global and the documentation doesn't indicate what works where. I  believe the current options are: trial and error, ask on githib 😉...
Thank again for the responses!  I'm still learning Laravel and comming from a nodeJS background.  Appreciate the patience.

The thing is you can't return from the middleware what you want, you must call and return the next layer of the middleware stack:
return $next($request);

The only other option is to raise an exception.

This is all very old I know, but readers might not know this.

The thing is you can't return from the middleware what you want, you must call and return the next layer of the middleware stack:

That's not true, any middleware can just return any response and ignore $next ,e.g. with an implementation like this
return response('Hi there, I took over the middleware stack');

authors: Cleanshooter GrahamCampbell hellfull ivorobioff kmuenkel ndberg pablorsk robopzet rudiedirkx topoff warlof wojcikm


text:
MINOR feature request: improved model stub

Laravel Version: 5.4.0
PHP Version: N/A
Database Driver & Version: N/A

Description:
Upon generating a new model in Laravel, a file like the following is created:
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class MyModel extends Model
{
    //
}

This file does not make obvious the large number of protected members available. Nearly 100% of the time I find myself having to manually type:
/**
 * The attributes that are mass assignable.
 *
 * @var array
 */
protected $fillable = [];

just to get started. It would make development faster and prevent simple bugs from accidentally mistyping these common attributes if the Model stub gave you a pre-commented list of available protected members when a model was first generated. Something like:
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class MyModel extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable;

    /**
     * The attributes that aren't mass assignable.
     *
     * @var array
     */
    protected $guarded;

    /**
     * The attributes that should be mutated to dates.
     *
     * @var array
     */
    protected $dates;

    // ... (continue with all protected members)
}

I feel this would make Laravel a bit easier and faster to work with, and it would prevent simple mistakes like misspelling a protected member.
Steps To Reproduce:
php artisan make:model MyModel

What about the developers that already read the documentation and knows how it works and don't want to clutter their model with useless code?

Best way would be to introduce an option into the make model command to include these attributes if desired. Eg. php artisan make:model MyModel --attrubutes

I could agree with that.
If enough people agree I may go ahead and work on a PR for it. Shouldn't be too complicated.

If you need it for yourself, you can easily extend the MakeCommandConsole and override the stub method, but if the goal is to help new developers, then you're in a contradiction because they won't know about the optional parameter without reading the documentation and if they read the documentation, they don't need this at all.

open feature requests in the laravel/internals repo. :)

For suggestions and feature requests please use the https://github.com/laravel/internals repo.

source: gharchive/issue

authors: Dylan-DPC deleugpn mrkatz stevendesu themsaid

repo: laravel/framework

license: MIT

license_type: permissive

license_source: github-api


text:
session expired when running 2 separate laravel application

Laravel Version: 5.5
PHP Version: 7.0

Description:
i have two laravel app running on my xampp/htdocs directory.
let first app as x, second app as y.
Steps To Reproduce:
when im running x on another browser window, y session expired and vice versa. any idea?

Maybe your browser flushes the section with the same name. Try change one of application's session name

@gabriel-caruso thanks, that solve the problem haha

authors: gabriel-caruso sayaamiruladli


text:
Using both 'web' & 'auth:api' middlewares at the same time for Broadcast Events

Laravel Version: 5.4
PHP Version: 7.2
Database Driver & Version: mysql

I am using Laravel Event Broadcast and Pusher to utilize websockets both on my API and Web. If I try them individually, both work. What I mean is:
Broadcast::routes(['middleware' => 'web']); // this works for my Laravel website

Broadcast::routes(['middleware' => 'auth:api']); // this works for my api

However, if I want to use both at the same time like this:
Broadcast::routes(['middleware' => ['auth:api', 'web']]); // doesn't work

... it crashes for both, which I suspect that it is assuming I am trying to enable for both auth:api && web middlewares.
Is there a way to use an OR kind of statement for this (auth::api || 'web')? What if I want to use both at the same time and if it passes one middleware, it bypasses the middleware.

I have found this comment in a Laravel Echo issue, but couldn't replicate it at all.
What I tried is creating a new Middleware called Broadcast and do this accordingly:
class BroadcastMiddleware() {

  public function handle() {
    $web = Auth::guard('web')->user();
    if ($web) {
        return response()->json($web);
    }

    $api = Auth::guard('api')->user();
    if ($api) {
        return response()->json($api);
    }
    return response()->json('Unauthorized.', 500);
  }
}

And also tried setting up a route for /broadcast/auth
Route::post('/realtime/auth', function(){
    return true;
})->middleware('broadcast');

However, using above code, it's returning User model; however instead Laravel's broadcasting/auth return something like: auth:"374f7ff42b7da877aa35:c29addedec281b418331a61dc3cfc74da8b108222565fa4924a8..."
Did any of you faced with a similar issue? How can I overcome this and actually use either of them (web/auth:api)?
Also please note that I am using Laravel Passport for my api.

Here on StackOverflow, I have added my way of solving this, however I'd like to hear any improvements or any other (more elegant) ways of achieving this. Hope it helps someone

I am using Laravel Event Broadcast and redis to utilize websockets both on API  (Android App ) and Web.
The solution not worked for me ( i can't connect with web @ api) in the same time.
I can only connect Android app (api) with  Broadcast::routes(['middleware' => 'auth:api']); in BroadcastServiceProvider.
Or connect from Web withBroadcast::routes()
But I want to use both at the same time.
I tried all those solutions but not working for me, i created the middleware, the route in web.php
but not working.
I need a help please, If anyone have a solution that work
@sentiasa   thanks.

@slim1616 I can't really comment without knowing your code. What is the error you are getting?
This guy's solution seems the nice way to go, in fact I didn't try it personally - https://stackoverflow.com/a/52271897/4705339
Otherwise I am not really sure why my code on SO doesn't work for you.

@sentiasa Hello,
I follow all the steps but not working :(

middleware :
` public function handle()
{
 $web = Auth::guard('web')->user();

if ($web) {
return response()->json(\Illuminate\Support\Facades\Broadcast::auth($request));
}
return response()->json('Client can not be authenticated.', 500);
}`

in web.php  i added route :

Route::post('/guard/broadcast/auth', function(\Illuminate\Support\Facades\Request $req){

		    return true;
		})->middleware('broadcast');

in BroadcastServiceProvider :
Broadcast::routes(['middleware' => 'auth:api']);

laravel-echo-server.json :
"authEndpoint": "/guard/broadcast/auth",

result :
with web all work but with Api not worked and i have this error :
⚠ [21:49:55] - 7cMngQlPZYtVyhsdAAAF could not be authenticated to private-unique_3_0 {     "message": "",     "exception": "Symfony\\Component\\HttpKernel\\Exception\\HttpException",     "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",     "line": 203,     "trace": [         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",             "line": 175,             "function": "prepareException",             "class": "Illuminate\\Foundation\\Exceptions\\Handler",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/app/Exceptions/Handler.php",             "line": 49,             "function": "render",             "class": "Illuminate\\Foundation\\Exceptions\\Handler",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 83,             "function": "render",             "class": "App\\Exceptions\\Handler",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 55,             "function": "handleException",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php",             "line": 49,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\View\\Middleware\\ShareErrorsFromSession",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",             "line": 63,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Session\\Middleware\\StartSession",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php",             "line": 37,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php",             "line": 59,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Cookie\\Middleware\\EncryptCookies",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 104,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Router.php",             "line": 667,             "function": "then",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Router.php",             "line": 642,             "function": "runRouteWithinStack",             "class": "Illuminate\\Routing\\Router",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Router.php",             "line": 608,             "function": "runRoute",             "class": "Illuminate\\Routing\\Router",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Router.php",             "line": 597,             "function": "dispatchToRoute",             "class": "Illuminate\\Routing\\Router",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",             "line": 176,             "function": "dispatch",             "class": "Illuminate\\Routing\\Router",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 30,             "function": "Illuminate\\Foundation\\Http\\{closure}",             "class": "Illuminate\\Foundation\\Http\\Kernel",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php",             "line": 65,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Barryvdh\\Debugbar\\Middleware\\InjectDebugbar",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/fideloper/proxy/src/TrustProxies.php",             "line": 57,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Fideloper\\Proxy\\TrustProxies",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",             "line": 31,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",             "line": 31,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",             "line": 27,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",             "line": 62,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 104,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",             "line": 151,             "function": "then",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",             "line": 116,             "function": "sendRequestThroughRouter",             "class": "Illuminate\\Foundation\\Http\\Kernel",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/public/index.php",             "line": 55,             "function": "handle",             "class": "Illuminate\\Foundation\\Http\\Kernel",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/server.php",             "line": 21,             "function": "require_once"         }     ] } Client can not be authenticated, got HTTP status 419 ⚠ [21:49:56] - 7cMngQlPZYtVyhsdAAAF could not be authenticated to presence-unique_3_0 {     "message": "",     "exception": "Symfony\\Component\\HttpKernel\\Exception\\HttpException",     "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",     "line": 203,     "trace": [         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",             "line": 175,             "function": "prepareException",             "class": "Illuminate\\Foundation\\Exceptions\\Handler",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/app/Exceptions/Handler.php",             "line": 49,             "function": "render",             "class": "Illuminate\\Foundation\\Exceptions\\Handler",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 83,             "function": "render",             "class": "App\\Exceptions\\Handler",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 55,             "function": "handleException",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php",             "line": 49,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\View\\Middleware\\ShareErrorsFromSession",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",             "line": 63,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Session\\Middleware\\StartSession",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php",             "line": 37,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php",             "line": 59,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Cookie\\Middleware\\EncryptCookies",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 104,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Router.php",             "line": 667,             "function": "then",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Router.php",             "line": 642,             "function": "runRouteWithinStack",             "class": "Illuminate\\Routing\\Router",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Router.php",             "line": 608,             "function": "runRoute",             "class": "Illuminate\\Routing\\Router",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Router.php",             "line": 597,             "function": "dispatchToRoute",             "class": "Illuminate\\Routing\\Router",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",             "line": 176,             "function": "dispatch",             "class": "Illuminate\\Routing\\Router",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 30,             "function": "Illuminate\\Foundation\\Http\\{closure}",             "class": "Illuminate\\Foundation\\Http\\Kernel",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php",             "line": 65,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Barryvdh\\Debugbar\\Middleware\\InjectDebugbar",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/fideloper/proxy/src/TrustProxies.php",             "line": 57,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Fideloper\\Proxy\\TrustProxies",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",             "line": 31,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",             "line": 31,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",             "line": 27,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",             "line": 62,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 151,             "function": "handle",             "class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",             "line": 53,             "function": "Illuminate\\Pipeline\\{closure}",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",             "line": 104,             "function": "Illuminate\\Routing\\{closure}",             "class": "Illuminate\\Routing\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",             "line": 151,             "function": "then",             "class": "Illuminate\\Pipeline\\Pipeline",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",             "line": 116,             "function": "sendRequestThroughRouter",             "class": "Illuminate\\Foundation\\Http\\Kernel",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/public/index.php",             "line": 55,             "function": "handle",             "class": "Illuminate\\Foundation\\Http\\Kernel",             "type": "->"         },         {             "file": "/Users/tech/Desktop/Qlearning/Qlearning/server.php",             "line": 21,             "function": "require_once"         }     ] } Client can not be authenticated, got HTTP status 419
thanks for your help

If you just want as me to be able to present user interfaces when loged in with api (dekstop app with some views costumized but not every) you can just have
Route::prefix('1stparty/web')->middleware('scopes:*')
     ->group(base_path('routes/web.php'));

localhost/settings will in example show users name and will check if he is loged in
this will change it to:
localhost/api/1stparty/settings and will still work

Hi! It's my solution. You can use something like this
BroadcastServiceProvider.php
Route::post('broadcasting/auth', function () {
   $url = request()->hasHeader('Authorization') ? '/api' : '/web';

   $proxy = Request::create($url . '/broadcasting/auth', 'POST', request()->toArray());
   $proxy->headers = request()->headers;

   return app()->handle($proxy)->content();
});

Broadcast::routes(['prefix' => 'web', 'middleware' => ['web']]);
Broadcast::routes(['prefix' => 'api', 'middleware' => ['auth:api']]);

authors: Zeratyll honzapatCZ sentiasa slim1616


text:
Mail Notifications are not sent

Laravel Version: 7.25.0
PHP Version: 7.3.12
Database Driver & Version: MariaDB 10.4.10

Description:
I have a project with an Account Model that is meant to send a mail Notification
The mail notification is not sent and I do not receive any error
I have Mailtrap's SMTP setup in the .env file.
here are my files:
##Account Model
<?php

namespace App\Models;

use App\User;
use Carbon\Carbon;
use App\Models\IncomeSetting;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;

class Account extends Model
{
    use Notifiable;
    protected $guarded = [];
    protected $dates = ['dob', 'created_on'];

    public function routeNotificationForAccount()
    {
      return $this->phone_number;
    }

    public function setDobAttribute($value)
    {
        $this->attributes['dob'] = Carbon::parse($value)->format('Y-m-d');
    }

    public function setCreatedOnAttribute($value)
    {
        $this->attributes['created_on'] = Carbon::parse($value)->format('Y-m-d');
    }

    public function path()
    {
      return "/accounts/clients/{$this->id}";
    }

    public function marketer()
    {
        return $this->belongsTo(User::class, 'marketer_id');
    }

    public function account_balance()
    {
        return $this->hasOne(AccountBalance::class);
    }

    public function income()
    {
        return $this->hasOne(Income::class);
    }

    public function sms_verification()
    {
        return $this->hasOne(SmsVerification::class);
    }

    public function email_verification()
    {
        return $this->hasOne(EmailVerification::class);
    }

    public function sms_verification_settings()
    {
        return SmsVerificationSetting::all()->first();
    }

    public function account_opening_charge_details()
    {
        return IncomeSetting::where('id', self::INCOME_TYPE['account_opening'])->first();
    }

    private const INCOME_TYPE = [
        'account_opening' => 1,
        'loan_application' => 2,
        'loan_interest' => 3,
    ];

}

The store method of the AccountsController
<?php

namespace App\Http\Controllers\Accounts;

use Keygen\Keygen;
use App\Models\Account;
use Illuminate\Http\Request;
use App\Events\AccountCreated;
use App\Models\AccountBalance;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
use App\Http\Requests\CreateAccount;
use Illuminate\Support\Facades\Gate;
use App\Notifications\VerifyPhoneNumber;
use App\Notifications\VerifyEmailAddresss;
use App\Services\Currency\CurrencyAbstract;

class AccountsController extends Controller

{

    ...

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(CreateAccount $request, CurrencyAbstract $naira)
    {
        if (Gate::denies('create-accounts')) {
            abort(403, 'Unauthorized.');
        }

        DB::transaction(function () use ($request, $naira) {
            $account = auth()->user()->registers_accounts()->create($request->validated());

            $account->sms_verification()->create([
                'otp' => Keygen::numeric(6)->generate()
            ]);

            $account->account_balance()->create([
                'available' => $naira->toKobo(0),
                'ledger' => $naira->toKobo(0)
            ]);

            $account->income()->create([
                'user_id' => $account->user_id,
                'description' => $account->account_opening_charge_details()->description,
                'amount' => $account->account_opening_charge_details()->amount,
            ]);

            $account->notify(new VerifyEmailAddresss($account));

            // event(new AccountCreated($account));

        });

    }

    ...

}

The VerifyEmailAddresss Notification class
<?php

namespace App\Notifications;

use App\Models\Account;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class VerifyEmailAddresss extends Notification implements ShouldQueue
{
    protected $account;

    use Queueable;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct(Account $account)
    {
        //
        $this->account = $account;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        // dd($notifiable);
        return (new MailMessage)
                    ->line('Please verify your email address by clicking this button below.')
                    ->action('Verify Email', url('/'))
                    ->line('Thank you for using our application!');
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}

Mailtrap's config
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=5b05605ded388a
MAIL_PASSWORD=3856cf6ab4def7
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=somename@gmail.com
MAIL_FROM_NAME="${APP_NAME}"

Steps To Reproduce:
I run the following test to create a new account and actual notifications(I am not mocking the notifications) get sent as a side effect.
    /** @test */
    public function a_new_account_creates_an_income()
    {
        $this->withoutExceptionHandling();

       ...

        $newAccount = factory('App\Models\Account')->raw();

        $this->post('accounts/clients', $newAccount);

        $this->assertCount(1, Income::all());

    }

I see that the notification class implements the ShouldQueue Interface
what is the Queue connection in the .env file
if it is not sync are you running the worker ? php artisan queue:work --tries=3

I see that the notification class implements the ShouldQueue Interface
what is the Queue connection in the .env file
if it is not sync are you running the worker ? php artisan queue:work --tries=3

I test the Notification via a test file that tries to create a new account and the notification is a result of that.
from my experience running the queue worker is not necessary when running tests.

I tried to replicate the action: creating a new account via a route and testing that from the browser and I got the notification. it seems Mail Notifications don't work within a test (I have tried SMS notifications and they do work).
The question now is how I test Mail Notifications

@seewhy17 have you tried faking your Mail or Notification class in the test itself? Like: Mail::fake() or Notification::fake().

authors: ahmedsayedabdelsalam mailopl seewhy17


text:
Allow all policy abilities except attaching

PHP version: 7.4.27
Laravel version: 8.80.0
MySQL version: 8.0.27-0ubuntu0.21.10.1
MySQL Client version: mysqlnd 7.4.27

Description:
Not sure if this should come under Laravel or Nova, but here goes
// in a policy,

public function before($user, $ability)
{
    // I wish to allow all abilities, except attaching any new Sales Order Item
    // however, $ability does not return any values that start with `attach*`
}

public function attachAnySalesOrderItem(User $user, $model)
{
    return false;
}

If before() returns a non-null (true/false), then attachAnySalesOrderItem will never be called.
If before() returns null, attachAnySalesOrderItem will be called, but several other methods will also need to be defined, otherwise view and viewAny are not allowed
Perhaps check for existence of attachAnySalesOrderItem prior to calling before()?
It sounds confusing, but this is because default permissions of add, attach and detach are inverted from the rest

https://nova.laravel.com/docs/3.0/resources/authorization.html#undefined-policy-methods

Perhaps a better name for before() is default() and it refers to only CRUD (and not relationships) + make this more explicit in the docs?
Or introduce after() like gates?
I struggled with this for quite a while until it became clear and don't have the best way forward, but I'm sure someone at Laravel does :)

Steps To Reproduce:

Thanks @rodrigopedra

authors: bilogic driesvints


text:
Http client is not overwriting the content type header when attaching a file or even if you manually call another method

Laravel Version: 8.83.16
PHP Version: 8.1.5
Database Driver & Version: mysql

Description:
I came across a strange issue with the http client where the Content-Type header is not being overwritten by any method which will be called after the first set. See examples below.
Steps To Reproduce:
I have the base http client set to the below code example.
Http::asJson()
    ->baseUrl('https://webhook.site/')
    ->attach('File', $fileContent, 'testing-file.png')
    ->post('a808f079-7df8-4492-b553-6fde48ce64aa')

I have set it that I want the content type to be application/json within the attach method though there is a method asMultipart() which is called and this should overwrite the previous Content-Type header, however this doesn't overwrite it instead uses the application/json.
This issue is as well even if you don't use the attach method but instead you overwrite it at a later stage for example:
Http::asJson()
    ->baseUrl('https://webhook.site/')
    ->timeout(30)
    ->asMultipart()
    ->post('a808f079-7df8-4492-b553-6fde48ce64aa')

The above code will have the same issue expectation is the Content-Type to be set to multipart/form-data however it is still set to application/json.

In another try of trying to fix the above issue I tried to set manually the headers with the withHeaders method and when I set the Content-Type to multipart/form-data It was appended instead of overwritten .

Not sure if that one is an issue or it is meant to be in that way just though to mention it.

Hey there,
Unfortunately we don't support this version anymore. Please check out our support policy on which versions we are currently supporting. Can you please try to upgrade to the latest version and see if your problem persists? If so, please open up a new issue and we'll help you out.
Thanks!


text:
Template inheritance with multiple children renders incorrect data

Laravel Version
10.10.33
PHP Version
8.2.4
Database Driver & Version
No response
Description
When using template inheritance with @yield and @section by multiple children at the same time, only the data of the first child will be rendered. The other children will therefore show the data of the first child (in the inherited template). I would expect that every child template would be rendered with its own data.
I've created a repository to demonstrate the issue (also see 'Steps To Reproduce'). The last commit gives a clear picture of the setup. I've included three examples which all use the same template inheritance setup:

Simple Blade Includes
View Components
Livewire

https://github.com/wimski/laravel-view-inheritance-issue/commit/d2e6257bc8add924e4a59f5fb71504201a4139b2
Steps To Reproduce

Run the following commands:

git clone git@github.com:wimski/laravel-view-inheritance-issue.git
cd laravel-view-inheritance-issue
make setup

Visit http://localhost:8000 to view the issue.
Notice that in the actual results the second item always has concreteValue: bar (from the first item) instead of concreteValue: ipsum.

Hey there,
While this may be a legitimate issue, can you first try posting your problem or question on one of the support channels below? If this issue can be definitively identified as a bug, feel free to open up a new issue with a link to the original one and we'll gladly help you out.

Laracasts Forums
Laravel.io Forums
StackOverflow
Discord
Larachat
IRC

Thanks!

@crynobone I managed to fix 'my' issue like this:
https://github.com/wimski/laravel-view-inheritance-issue/commit/e2587a8c2f1e804aef9a97f1c2327f2396c2e8fe
use Illuminate\View\View as BaseView;

class View extends BaseView
{
    public function render(callable $callback = null): string
    {
        $contents = parent::render();

        $this->factory->flushSections();

        return $contents;
    }
}

Apparently all the section contents are cached during the entire request cycle, which results in incorrect data usage in rendering when you have multiple views extending the same parent in one page (request cycle). I resolved this by flushing the section cache after the rendering of each individual view (within the page/request cycle).
So either it's not a bug because extending views was always only intended to be used for a single view (a page), or it is. If the former is the case, a big disclaimer in the documentation would be nice so the limitations of extending are clear.
The fact that sections are cached by name during the rendering of an entire page, can have some weird effects if you use the same section names in different (unrelated) views. This consequence is also not mentioned in the documentation. And I'm wondering if that was ever an intended consequence.

authors: crynobone wimski


text:
[Request] nullable validation rule

I am running into a problem where I cannot unset a property of a eloquent model, because the validation rule says, that the value must be an integer and must match an existing entry in another table ('alliance_id'=>'integer|exists:alliances,id')
It would be great to have a 'nullable' validation option, which lets the validation pass if alliance_id is set to null (which would override the other rules, similar to the sometimes behavior)

This appears to no longer be functioning as expected in Laravel 5.3:
$validator =  Validator::make(
    array('alliance_id' => null),
    array('alliance_id' => 'integer')
);

$validator->fails()

Outputs true in php artisan tinker.
Is this something misconfigured with the Validator in my application or expected behavior? If it's expected, is there a way to allow null values as described in this issue?

check the official docs here

Thanks @devcircus adding nullable fixed this, even on 5.3.

authors: JNK cabloo devcircus


text:
[5.2] Don't query relationship when the parent key is null for HasOne & HasMany

We have users that have an optional organisation. When the organisation is empty the query is still run. The query looks for an organisation with id=0 where is not null, so the query is useless.
I added checks for the parentKey before the query is executed.

Failing tests.

Going to hold off on this.

source: gharchive/pull-request


text:
[5.2] Add Blade count directive

Docs update: https://github.com/laravel/docs/pull/2415
This commit implements a new Blade "count" directive which will echo the count result for a countable. I actually thought this was already in here so was pretty weird to see it not being in here.
Sent this to 5.2 because I thought this was a minor feature. If you want me to sent this to 5.3 let me know.

Why i need this ? I can use {{count($countable)}} :)

@eskrano or you can do @count($countable). Which I think is more readable and a bit shorter. You're not forced to use this directive :)

@driesvints you can use https://laravel.com/docs/5.2/blade#extending-blade this for create @count directive in your projects.

@eskrano true. Or it can ship natively so people don't have to do that.

@driesvints ok. If people don't have to do that you need create pull request to laravel docs site :smile:

@eskrano right! Almost forgot about the docs. Thanks for reminding me.

@driesvints but in docs it exists https://laravel.com/docs/5.2/blade#control-structures

@eskrano ah, I meant to add this: https://github.com/laravel/docs/pull/2415

authors: driesvints eskrano


text:
[5.3] Provide access to model collection from Eloquent Builder before pagination

Added methods that allow adding a callback to underlying collection before pagination and other collection methods in Eloquent Builder.
Use Case
There have been times where I've needed to append specific attributes to models, but not with $appends which always includes the attribute. For example, on a route used to search for new users to follow, it would be beneficial to return an attribute that displays if the returned users are following the authenticated user. This kind of attribute requires a user to be logged in and has a specific use case so I would rather control when and how it's used as opposed to adding to $appends.
The problem is that I haven't found a way to modify collections before paginating. In order to modify the models of a collection, there would need to be a way to access the collection before pagination occurs.
What I've tried so far
$users = new App\User;

return $users->append(['is_following'])->paginate(); // Attribute is not added to each model.

return $users->paginate()->append(['is_following']); // Method doesn't exist.

Only works when using first() since this method returns a model.
$users = new App\User;

return $users->first()->append(['is_following']); // Works.

Proposal
$users = new App\User;

$users = $users->onCollect(function($collection) {
        return $collection->each(function($user) {
            $user->append(['is_following']);
        });
    });

return $users->paginate(); // Attribute is added to each model.

There may already be a way to do this so please let me know if there is.

$users = new App\User;

$paginated = $users->paginate();

$paginated->getCollection()->each(function ($user) {
    $user->append(['is_following']);
});

return $paginated;

@crynobone That only returns the collection alone and no longer paginated results.

@tlaverdure
$users->getCollection()->each(function ($user) {
    $user->append(['is_following']);
});

return $users;

shouldn't be the same as
return $users->getCollection()->each(function ($user) {
    $user->append(['is_following']);
});

@crynobone gotcha 👍 . Thanks for the assistance! No need for this PR then.

authors: crynobone tlaverdure


text:
Missing escape characters

Missing escape characters, which makes the test failing even if it works properly.

Tests fail.

authors: Janiaje taylorotwell


text:
[5.8] Fix wrong relation parent key

Use parent->{$this->parentKey} instead of parent->getKey(). Sometimes we don't have primary key in pivot table.

Please provide a thorough explanation why this is needed and add a test that validates the fix.

I am closing this pull request because it lacks sufficient explanation, tests, or both. It is difficult for us to merge pull requests without these things because the change may introduce breaking changes to the framework.
Feel free to re-submit your change with a thorough explanation of the feature and tests - integration tests are preferred over unit tests. Please include it's benefit to end users; the reasons it does not break any existing features; how it makes building web applications easier, etc.
Thanks!

I have three tables.
// users
[{
    id: 1,
    uuid: "c3b5c66a-aebe-4c76-9a51-9c305ff6dad1",
    name: "John"
}]

// shops
[{
    id: 1,
    uuid: "84a11000-0a09-4054-bc9c-c4e49e2f48c5",
    name: "Nice Pizza"
}, {
    id: 1,
    uuid: "84a11000-0a09-4054-bc9c-c4e49e2f48c5",
    name: "Nice Flower"
}]

// user_shop(pivot table)
[{
    user_uuid: "c3b5c66a-aebe-4c76-9a51-9c305ff6dad1",
    shop_uuid: "25adf508-8dff-4a7f-ad26-3320f4d23f15"
}]

User extends Eloquent\Model
    /**
     * Has many shops
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function shops()
    {
        return $this->belongsToMany(Shop::class, 'user_shop', 'employee_uuid',
            'fuel_card_number', 'employee_uuid', 'card_number')
            ->using(UserShop::class);
    }

UserShop extends Eloquent\Relations\Pivot
// Empty

Run test code
    $user = \App\Models\User::first();
    $user->shops()->sync(['84a11000-0a09-4054-bc9c-c4e49e2f48c5']);
    dd($user->shops->toArray());

will cause QueryException
SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: 'c3b5c66a-aebe-4c76-9a51-9c305ff6dad1' (SQL: delete from `user_shop` where (`user_uuid` = 1 and `shop_uuid` = c3b5c66a-aebe-4c76-9a51-9c305ff6dad1))

Because user_uuid read $this->parent->getKey().

@driesvints , I don't know where should I add this test case. Could you please help me a bit?

Related to #28025. /cc @ralphschindler

Initial tests added in #28310, I can add more tests to that PR

authors: driesvints ralphschindler staudenmeir taylorotwell tinpont


text:
[5.8] Fix a typo in the endpoint property DocBlock in MailgunTransport class

Connected with this commit: https://github.com/laravel/framework/pull/29312/commits/506806263209701b983c4739c27d804e68e5f43f

Thanks.

authors: GrahamCampbell SerhiiStarovoitov


text:
Collection push() should use offsetSet() instead of directly setting items

In Laravel 5.x the Collection push() method used to call the offsetSet() method to add the new item to the items array.
This has been changed in 6.x to set the items directly but it breaks compatibility in apps which override the offsetSet() method and is not consistent with other methods like put(), groupBy() from 6.x which still use the offsetSet() method.

This could be a breaking change on the 6.x branch. We would need a better reason for changing this back.

authors: dcro taylorotwell


text:
[8.x] ApcWrapper checks if apc is enabled

Why we stumbled upon this (important)
We were using $maxExceptions for Jobs for a while now (when having endless retries set due to throttling etc jobs could be retried many times before they actually are allowed to run) with the expectation that this would work. However the first time a job was actually throwing exceptions, it would continue to do so for an endless amount of times.
After a lot of digging and debugging we figured out why. Our cache strategy has 'global' and 'local' cache. Global is set to redis, local is set to APC. Our default cache driver was set to apc
When $maxExceptions on jobs are set, laravel will use the default cache store to remember that an exception was thrown. In our case it was using APC, however APC(u) by default is not enabled for cli. As the queue workers are in cli-mode it was writing nowhere, and throwing now exceptions whatsoever.
What this PR is trying to fix
The false positive that we experienced was a little eye opening and we believe that if the code knows that storing something to apc will not work in any way, it should throw an exception (analog to if redis is not available or wrongly configured it will not silently do nothing, but throw an exception).
This will prevent others of running into the same false positive situation we had.
Similar discussions were made in symfony, and in their ApcuAdapter there is a 'isSupported' static which does something similar (minus the cli check)

I need to still figure out whats the correct approach with tests. Any feedback & suggestions warmly welcomed.

I need to still figure out whats the correct approach with tests. Any feedback & suggestions warmly welcomed.

Thanks for your pull request to Laravel!
Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.
If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions!
If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response.

Thanks for your pull request to Laravel!
Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.
If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions!
If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response.

authors: graemlourens taylorotwell


text:
[9.x] Direct stream download

Following up on Taylor's tweet (https://twitter.com/taylorotwell/status/1562195841062154240), I decided to open up this PR to address a small papercut I have to implement more than once on a few projects.
The fact that the ResponseFactory class only accepts a callback is slightly annoying as we have to manage the process of dumping the contents of the stream onto the response inside project code. This small change enhances Laravel to take on a PSR Stream object and directly output it as a download onto the browser.

Thanks for your pull request to Laravel!
Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.
If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions!
If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response.

authors: deleugpn taylorotwell


text:
[10.x] Improve numeric comparison for custom casts

This pull request improved numeric comparison for custom casts in originalIsEquivalent method.
After the improvement, changes like '9.00' to '9.0'  no longer trigger a dirty state.
// app/Models/Order.php
class Order extends Model
{
    protected $casts = [
        'amount' => DecimalCast::class,
    ];
}

// app/Http/Controllers/OrdersController.php
$order = new Order();
$order->amount = '9.00';
$order->save();

// Update the amount
$order->amount = '9.0';

Before:
dd( $order->isDirty('amount') ); // return true

After:
dd( $order->isDirty('amount') ); // return false

We reverted this.

authors: driesvints imahmood


text:
[11.x] Created a markdown helper to utilise the Illuminate\Mail\Markdown class

I have created a markdown helper function to reduce the utilisation of classes within the blade components.

[x] Added a function to the helpers file that will use the Markdown class
[x] Updated the mail blade components which utilises the Markdown class

If it's going to be a helper that just parses, you could abstract away the parse method as well? Or am I missing something?

Thanks for your pull request to Laravel!
Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.
If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions!
If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response.

@taylorotwell No worries, I completely understand, this is strictly cosmetic following the same methodology as the str and arr helpers.
It does not improve or fix anything and I'm happy for you to completely disqualify this PR.
Have a great weekend!

authors: KaniRobinson KaniTRobinson henzeb taylorotwell


text:
[11.x] Add AsCommand attribute to Console commands stub by default

Just thinking that maybe this should be the default behavior after all the work done in #50617 so I updated the stub.

Or maybe it would be better to setup a new Laravel contract that inherits from Symfony's AsCommand and maybe clean up some stuff from the Commands structure? And target this change for 12.x instead
Let me know what you think!

I think it's generally fine to not have this. We mainly did it in the framework because we have so many commands.

authors: taylorotwell wilsenhc


text:
Earley parser produces wrong parse Tree

Over on SO someone asked this question: https://stackoverflow.com/questions/76366280/parsing-formulas-using-lark-ebnf/76381256
As far as I can tell, it shows a bug in the earley parser where it duplicates some Tokens because of enormous amounts of ambiguities. I don't have the expertise with earley to figure out what is happening or the time to create a minimal example right now.

I have it down to:
grammar = """
start: (a+)*
!a.1: "A" |
"""

l = Lark(grammar)
tree = l.parse("A")
print(tree.pretty())

Output:
start
  a
  a     A
  a
  a     A

I suspect that the issue is somewhere in ForestToParseTree with resolve_ambiguity=True. I do not see the same problem in the tree returned when using ambiguity="explicit". I'll look into it more when I have a chance.

The issue is that when ambiguity="resolve", the ParseTreeBuilder will use the ChildFilterLALR filters. However, the ForestToParseTree cache breaks the ChildFilterLALR assumption that it is safe to change the parse tree. We have two options:

Disable the ForestToParseTree cache when ambiguity="resolve".
Always use the regular ChildFilter for earley.

Either will work, but they may have different performance implications.

@chanicpanic Thanks for looking into it!
Can you explain more about the performance implications?

The ForestToParseTree cache and ChildFilterLALR filter are both optimizations that happen to be incompatible with each other. So, the question is: which optimization gives the most performance benefit for earley with ambiguity resolution?
While the ForestToParseTree cache provides a significant speed-up for explicit ambiguous parses, its impact on ambiguity resolution is likely minimal. My hypothesis is that the cache is only relevant when a rule matches an empty string, and even then, the forest nodes have to be visited in a particular order.
On the other hand, I believe that child filtering is an operation that is performed for many grammars and inputs. So, the ChildFilterLALR would be used much more often.
Thus, I am leaning toward option 1 because I expect the ChildFilterLALR to have a greater overall performance benefit.

@chanicpanic Thanks for the explanation.
I think it's best to make an evidence-based choice, which makes me wonder, do you have an idea for what a good benchmark grammar&input for Earley would be?
I could run benchmarks on trick-grammars like start: start start |  "(" start ")" |, and normal grammars that are low on ambiguity. But maybe you know some real-world example that are ambiguous and would serve as a better measurement?
cc: @MegaIng

I stumbled across what I think is the same problem.
Here is the minimal example from my grammar:
GRAMMAR = r'''
start : _s x _s
x : "X"?
_s : " "?
'''

l = Lark(GRAMMAR)

# behave as expected
print(l.parse( " X " ).pretty())
print(l.parse( "X" ).pretty())
print(l.parse( " " ).pretty())

# produces two x nodes
print(l.parse( "" ).pretty())

output:
start
  x

start
  x

start
  x

start
  x
  x

I think it's best to make an evidence-based choice, which makes me wonder, do you have an idea for what a good benchmark grammar&input for Earley would be?
I could run benchmarks on trick-grammars like start: start start | "(" start ")" |, and normal grammars that are low on ambiguity. But maybe you know some real-world examples that are ambiguous and would serve as a better measurement?

@erezsh I don't have any real-world grammars that I think would be a better benchmark for Earley.
For this issue, I think it would be good to use the grammars in this thread, or variations that incorporate the same patterns, which are known to utilize the ForestToParseTree cache with ambiguity="resolve". Also, it would be good to benchmark with normal grammars that  reflect more typical lark usage.
I made branches for the two options that can be used for comparison:

https://github.com/chanicpanic/lark/tree/issue1283_no_ftpt_cache
https://github.com/chanicpanic/lark/tree/issue1283_no_child_filter_lalr

Hi @chanicpanic and everyone,
Sorry it took me this long to look into this!
I did some benchmarks, and my conclusion is it that - it really doesn't matter.
Both approaches seem to have the same performance in my tests, with less than 5% difference.
So, just choose whatever seems more "correct". I will accept a PR of either approach.

authors: MegaIng Shildifreak chanicpanic erezsh

repo: lark-parser/lark


text:
unable to fetch citation response in ie 11

The following error i am getting in the browser console:-
"SCRIPT8: The download of the specified resource has failed."
while it works  fine in mozilla and chrome browsers with the following warning in the console:-
"Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/".
I tried debugging the library and found that there  xhr have been used and also trying to make synchronous api call. So i think that is the issue with ie and edge, the synchronous api calls are getting deprecated.
So can anyone please update the library, and make an asynchronous call instead of synchronous one or find some another solution for that. It will be a great help. Thanks

Thank you for your question. There is already an asynchronous API:
// Callback
Cite.async(input, function callback (/* <Cite> */ data) { ... })

// Promise
Cite.async(input) // Promise<Cite>, use with `.then()` or `await`

Thanks for the reply :). But still I am  getting the same error in the console while i am using promise :-
// Promise
Cite.async(input)
in ie 11:-
error:-"The download of the specified resource has failed."
while the warning messages in chrome and mozilla browsers are gone.
Is this because we are using fetch api in the library?

The polyfill that Citation.js uses should support IE 10+. Can you share the input you're having problems with?

Please find the following code which i am using:-
var opt = {
format: "string",
type: "string",
style: "bibtxt",
lang: "en-US"
};
Cite.async("10.7717/peerj-cs.52").then((cite)=>{
var output = cite.get(opt);
console.log(output)
}).catch((error)=>{
console.log(error.message);
});
in ie 11 console :-
error:-"The download of the specified resource has failed."
I have attached the error object which i am getting in the console.

The main difference between the Firefox & Chrome code and the IE11 code is the Fetch API polyfill, which isn't usually applied on Chrome & Firefox since they have it natively already. However, it seems to be working fine for me (both synchronously and asynchronously) when I test it in IE11 on Browserstack. I might be able to test on a real machine with IE11 in a few days, I'll report back if I find it out.
For the record, the error code apparently corresponds to INET_E_DOWNLOAD_FAILURE (0x800C0008), with the following description:

The download has failed (the connection was interrupted).

Sure Thanks.

What version of Citation.js are you using?

Actually I have included it in my index.html file like this :-

also one more thing, is this related to CORS issue  because in network i am able to see that we are making a call to "https://data.crossref.org/10.7717/peerj-cs.52" api ?


text:
Diff/Patch - improvement to filter by type

Use case: I would like to be able to hide for example all diffs in message classes or test data containers, which will both fall under xml.

The filter should work based on object type and not the filename extension.

perhaps have both possiblities, per file extension and per object type

authors: FreHu larshp

repo: larshp/abapGit

license: mit

license_source: bigquery


text:
Update sbt to 1.5.8

Updates org.scala-sbt:sbt from 1.4.9 to 1.5.8.
GitHub Release Notes - Version Diff
I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.
If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.
Configure Scala Steward for your repository with a .scala-steward.conf file.
Have a fantastic day writing Scala!

Applied Scalafix Migrations

org.scala-sbt:sbt:1.5.0 (created no change)

https://gist.githubusercontent.com/eed3si9n/57e83f5330592d968ce49f0d5030d4d5/raw/7f576f16a90e432baa49911c9a66204c354947bb/Sbt0_13BuildSyntax.scala
Documentation: https://eed3si9n.com/syntactic-scalafix-rule-for-unified-slash-syntax

Ignore future updates
Add this to your .scala-steward.conf file to ignore future updates of this dependency:
updates.ignore = [ { groupId = "org.scala-sbt", artifactId = "sbt" } ]

labels: library-update, early-semver-minor, semver-spec-minor, scalafix-migrations, commit-count:1

Superseded by #164.

repo: laserdisc-io/eisner


text:
AngularJS generators compared

Hi group,
I want to help.
But I'm an AngularJS newcomer.  That being the case, I am making this comparison of AngularJS generators.  The comparison is an editable Google spreadsheet.  So I welcome your corrections, additions and feedback.  I also welcome you to add a column for modern-web-template.
I don't think anyone has done this before, but if you know otherwise, please let me know.
My goals of this research are to:

Educate people about what can go into an app with AngularJS
Help expedite the convergence of best practices
Reduce time spent in duplicating features without knowledge of prior art

I hope you find this helpful.
Best regards,
Dan

Issues should be related to this Codebase i.e  enhancements, bugs, suggestions etc.  There are plenty of places for this sort of thing, this not being one of them. :-)

authors: dancancro lashford

repo: lashford/modern-web-template


text:
Fix logo in self-hosted variant.

I have started to self-host obligator. I found that the logo is broken when using the Dockerfile as provided, with no config able to fix it.
I was able to fix it for my own use, here: https://github.com/lastlogin-net/obligator/compare/main...nbeirne:obligator:fix-logo-svg. I don't think this fix is acceptable for other people, though. I basically just copy the obligator logo into the docker container, at the static path.
I suppose an alternate fix is to fix LogoPng in the config, then use a docker volume for the static assets. I think it would make sense to fix it for people if they just want to pull the docker image without needing extra configuration, though.
I don't mind making attempting to fix it myself, but I do want your opinion as the maintainer on how you would prefer to do so.

I'm not opposed to just using the SVG. Are there any potential pitfalls to that approach? Last time I checked some browsers have issues with SVG favicons, but the logo should be fine.

I'm not a web developer, so honestly I have no idea. My biggest worry is breaking other people's configurations and your real production setup. I can open my changes a PR if you like

authors: anderspitman nbeirne

repo: lastlogin-net/obligator


text:
[editor] Update HF conversational prompt schema with parameters

[editor] Update HF conversationalprompt schema with parameters
Taken from https://huggingface.co/docs/api-inference/detailed_parameters#conversational-task
Skipped the options dictionary for now, they are not relevant to inference.
testplan
https://github.com/huggingface/huggingface_hub/assets/141073967/59039705-64cd-453f-a09c-090c7beef597
Dependencies:
continued from: https://github.com/lastmile-ai/aiconfig/pull/1230

Stack created with Sapling. Best reviewed with ReviewStack.

-> #1235
#1233

Does streaming not work? Going off of the test plan video

authors: Ankush-lastmile saqadri

repo: lastmile-ai/aiconfig


text:
Add Lint check to ci/cd

Add Lint check to ci/cd

This is just running prettier, not actually linting, right? I would expect lint with yarn:

Yep, was just playing around with the github action from the marketplaces to figure out how it works. Its great and its extensible enough to be used with python and typescript. Running the python linter bubbles up 150+ exceptions 😅

This is just running prettier, not actually linting, right? I would expect lint with yarn:

But I was trying to run linting with prettier rules, not sure if that should be done in addition to yarn lint

closing for now, will revisit later


text:
[Typescript] CI/CD {WIP}

[Typescript] CI/CD {WIP}

skipping lint, needs fixes

Stack created with Sapling. Best reviewed with ReviewStack.

-> #46
#42
#43

Disabled Lint, repo isn't implemented to lint rules yet

expected tests to fail, fixing

split into two diffs, ci/cd ontop. This diff contains test fixes


text:
Explore hot reloading

I might be able to replace an entire module when it changes now that we are using SystemJS in a more idiomatic fashion.

Each module could be hotswapped, and then if any html or images change, we could just set the html on our own...could it be possible? Or we could just reload the web component that changed and reinsert it into the DOM

Hmmm...I'm not sure hot reloading is worth it. Just refreshing the page on file changes I think is good enough

repo: lastmjs/zwitterion


text:
Pointing to follow method within link_to or button_to?

How would you use @someuser.follow(@anotheruser) within a link_to or button_to tag? I've tried several different methods and am currently just calling it from within link_to as <%= link_to "Follow", someuser.follow(anotheruser) %> but of course, the function is called whenever the page is loaded AND when the link is clicked. This is fine on pages only calling the function once, but in others (say a user directory), it just reverses the follow/unfollow whenever the page is load.
Ideas?

I guess that you want to make it an ajax request. Generally, you can write a method for this in your controller, and make it respond to ajax request. Meanwhile, add a 'remote => true' attribute to wherever you put your "Follow" button. Actually, it's quite a long story and impossible for me to give all the details here. So, I recommend you to check some rails books like ruby tutorials http://ruby.railstutorial.org/ and rails guides http://guides.rubyonrails.org.
Good luck!

authors: ferrettim lastomato


text:
スクリプト生成で、リンクの中に空白文字が入っている場合にも良いロケータを生成する

Is your feature request related to a problem? Please describe.
現状、空白文字が入っているリンクに対してはXPathを使っている。
空白文字が入っているリンクをlinkTextで補足しようとするとエラーになる
記録されたelementのvalueをlinkTextかpartialLinkTextを用いて補足することを想定
例えば、
が入っていると生成スクリプトに改行がそのまま反映されシンタックスエラー
空白文字含むものをlinkTextで補足する方法があるのかを検討
nbsp, tab,
 が記録時にどう記録されているかを確認
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.

とあるが，正しくは特殊文字表記の<br>とみられる．
であればv2.7.1では再現しない（修正済み）

repo: latteart-org/latteart


text:
SQLx action uses node12 which is deprecated

https://github.com/launchbadge/sqlx/actions/runs/10063866576

repo: launchbadge/sqlx


text:
Bump rsa dep in sqlx-core

The purpose of bumping the rsa crate in sqlx-core is for the relaxed zeroize dependency in rsa 0.7.2, which should make it possible to use sqlx as a dependency in more programs

Base changed to 0.7-dev, the change you want to make is now going to be in sqlx-mysql/Cargo.toml

Closing due to inactivity, feel free to reopen.

authors: RohanKapurDEV abonander


text:
Way to print out world properties

While working on oregen for various dimensions, I couldn't find a way to get the name of the current generator. Is there any way to print out things like dimension.generator and if not could such a command be added?

Seems like this should be the role of another mod.

I don't know about "dimension.generator", but if you choose to use "dimension.generator.class", you can find the name of the mod's dimension generator class.  Usually, the class used in a mod is of the style ChunkProvider(something), where (something) is usually specific to that mod (for example, ChunkProviderEnd or ChunkProviderTwilightForest).

authors: lawremi reteo retep998

repo: lawremi/CustomOreGen


text:
Topics page html changes

https://github.com/laws-africa/constitution-app-react/blob/master/src/pages/topics/Topics.tsx#L42 should match https://github.com/laws-africa/constitution-app/blob/master/src/app/topics/topics.page.html#L19
ie. h3 and p, not IonListHeader

Remove CSS

repo: laws-africa/constitution-app-react


text:
Add entry for MeshMap project

Current Behavior
https://layer5.io/meshmap project is missing from the project list on the layer5io org profile.
Implementation
use the MeshMap logo from layer5.io/brand and create new entry with a short description

Contributor Handbook

🙋🏾🙋🏼 Questions: Discussion Forum and Community Slack

Sounds great, @Younus-Saberi

Thank you @leecalcote 😄, I have made a PR regarding it. Do let me know your suggestion

authors: Younus-Saberi leecalcote


text:
Cached Manifests during Kubernetes deployment

Description
This PR fixes #2580
Notes for Reviewers
Added a yaml sruct and a new function for getting cached local manifests
Signed commits

[x] Yes, I signed my commits.

@piyushsingariya should I look into setting a unit test for the new function? If so, where are the unit tests so I can see how they are made?

@navendu-pottekkat @kumarabd a question on unit tests for mesheryctl.

@Maxgit3 We do not have unit tests for mesheryctl currently, but it is something that we are planning to add shortly. I would put it in the next release v0.7

@Maxgit3 @piyushsingariya What is the status for this PR?

@navendu-pottekkat I think it would just need to be tested to run offline.  I was looking into how that could be done.  does meshery have something like that?

@navendu-pottekkat I think it would just need to be tested to run offline. I was looking into how that could be done. does meshery have something like that?

@Maxgit3 You can test Meshery offline with your PR? I mean you should first have Meshery on your machine and then stop it and run without the Internet.
The initial fetching of files can be avoided for now.

@navendu-pottekkat I was working on testing offline.  I didnt see an option to switch between kubernetes and docker environment.  it always defaults to docker

A couple ways - https://docs.meshery.io/reference/mesheryctl/system/context
system context switch
system context create blah -p kubernetes
vi ~/.meshery/config.yaml

A couple ways - https://docs.meshery.io/reference/mesheryctl/system/context system context switch system context create blah -p kubernetes vi ~/.meshery/config.yaml

@metonymic-smokey ... a perfect excuse for another docs entry or blog post....

@leecalcote thank you

@leecalcote @navendu-pottekkat  I am running into an issue.
creating ~/.meshery/manifests folder....  downloading manifest files from https://github.com/layer5io/meshery/tree/v0.5.18/install/deployment_yamls/k8s Starting Meshery... Error: failed to start Meshery See https://docs.meshery.io/guides/mesheryctl/#meshery-lifecycle-management for usage details : Unable to discover an endpoint
I am using the Kubernetes KIND setup to test the ./mesheryctl build
The current Context is set to Kind-kind cluster
I have the .kube/config file in the home/user directory

@piyushsingariya @Maxgit3 A sample unit test implemented in istio adapter, we can follow the same. Do suggest changes if you have a better one - https://github.com/layer5io/meshery-istio/blob/master/istio/istio_test.go

@kumarabd @metonymic-smokey Any idea why the endpoint is not being discovered?

@Maxgit3 , are you able to access Meshery UI? If that is the case, then this could be a bug

@navendu-pottekkat I am not able to access the meshery UI. seems like some configuration issue. maybe with Kind?

Hmm, not sure. Deploying to KinD is pretty straightforward...
Could you try with MiniKube?

@navendu-pottekkat ok I will try minikube.  do you have to have something deployed and a service in the default namespace.  I wonder if thats why the kind is not discovering endpoints

You can add a loadbalancer to your cluster to expose the services. sth like
metallb
On Fri, 11 Jun 2021 at 06:04, Maxgit3 @.***> wrote:

@navendu-pottekkat https://github.com/navendu-pottekkat ok I will try
minikube. do you have to have something deployed and a service in the
default namespace. I wonder if thats why the kind is not discovering
endpoints
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/layer5io/meshery/pull/2807#issuecomment-859176303,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ALZOXQYPFNJAJSBNWSHBQTTTSFK2XANCNFSM44AARWRA
.

@Maxgit3 Were you able to try it out locally?

@navendu-pottekkat I have some time tomorrow to try it out locally

@navendu-pottekkat I am having computer issues.  working on fixing them.

@Maxgit3 any updates, are working on this? Let's try to get this landed quickly.

@navendu-pottekkat sorry about the late reply.  still having issues with my computer.  I probably will have to upgrade to something more powerful

@Maxgit3 are you able to work on this? It would be best to have this soon in mesheryctl. Please signal so that another contributor can take this from here.

@NupurThakur27 FYI ^

@navendu-pottekkat I'm sorry.  just don't have a computer sufficient enough to handle running kubernetes.  probably best to have someone else handle the issue

Thank you for the update @Maxgit3

@navendu-pottekkat @Maxgit3 Can I start further on this PR or probably start from scratch on #2580 ?

Sure @NupurThakur27 , closing this PR


text:
Added Confirmation when Channel is Set

Description
It is an initial Draft PR for review and fixes.
This PR fixes #2952
Notes for Reviewers
Signed commits

[x] Yes, I signed my commits.

@DARK-art108 is this still a draft PR or is it ready for review?

@leecalcote This is a draft PR, I have opened it to get review.

@DARK-art108, ok, in that case, you'll want to remove the draft state by clicking "Ready for Review". A draft state PR means that you're working on it and are not ready for people to look at it. When you've marked it Ready for Review (or just submitted it without draft flagged), then maintainers will take a look.

@DARK-art108 @leecalcote I have left a review above, please check it out


text:
[ci] Add a build step in GitHub Actions

The build step only happens in the manual release flow.
When I added the checks.yml workflow, I neglected to add a build step to follow up.

Contributor Guide

🎨 Wireframes and designs for Layer5 site in Figma (open invite)

@nebula-aac if granted, can i work on this particular issue?

@nebula-aac I have given a PR #159 regarding this issue, kindly review this

authors: Debaditya-Som nebula-aac