Howdy, this video is free to watch, but you need to login first :)
5 minutes and 34 seconds
In this short video we'll show you how to inject code into your views using Middleware. You can create a shortcode in your view files and replace it with anything you would like using Middleware.
This will come in handy if you release a product and want to dynamically change content in your views from a shortcode. Here is the Middleware class that we used in the video:
* Handle an incoming request.
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
public function handle($request, Closure $next)
$response = $next($request);
$content = str_replace('<!--[shortcode_hello]-->', '<!--[shortcode_hello]-->Hello There', $response->content());
Hope you find this useful. Thanks :)
Share This Video:
I'm Tony, the creator of this site. I'm trying to increase my twitter following. Want to follow me?