Glitter Bomb Trap 2.0

Glitter Bomb Trap 2.0

https://ift.tt/35ooiKJ

Glitter Bomb Trap 2.0

Link

After building an ingenious device to befuddle porch package thieves, Mark Rober is back with a new and improved version. Like the original, it shoots video of the thief, fires off glitter and fart bombs, but with a little help from his friend Sean Hodgins and Home Alone star Macaulay Culkin, this version is better in every way.

fun

via The Awesomer https://theawesomer.com

December 15, 2019 at 12:45PM

[VLOG] What Are the Scrum Product Owner Accountabilities

[VLOG] What Are the Scrum Product Owner Accountabilities

https://ift.tt/2rJG9gr

Hey awesome people. The Product Owner role is often underestimated. When an organisation is transitioning to use Scrum, it is not rare to see people perceive Product Owner as the business analyst or requirements engineer just managing the Product Backlog. It is also not rare to see the Product Owner who are just focused on the project lifecycle and delivering on time, on scope and on budget. And the Product Owner role is perceived as a low level tactical role because theScrum Guide does not explicitly write down other activities the Product Owner should do outside of Scrum, it is not rare to see an additional layer on top of the Product Owner called the Product Manager.

In today’s vlog, I share what is the Product Owner role is about and what is the broad accountabilities of the Product Owner. Being a Product Owner is not easy and as a Scrum Master I will do my best to serve the Product Owner so that they can do outstanding job as a Product Owner. Hopefully today’s vlog is helpful for those of you who are new to Scrum and Product Owner role.

 

 

scrum/agile

via Scrum.org Blog https://ift.tt/2TTJdzo

December 13, 2019 at 08:02PM

The 6 Best Websites to Find Guitar Chords for Songs

The 6 Best Websites to Find Guitar Chords for Songs

https://ift.tt/35jp3oh

Playing guitar is a fantastic way to relax and de-stress. One of the best things about the guitar is the sheer number of songs you can play with a few chords. All you need now is a good website with all the guitar chords and lyrics to your favorite songs.

Luckily for you, the internet is full of awesome options.

We’ve pulled together the best websites to find free guitar chords and lyrics to all the most popular songs. Let’s start playing!

1. Ultimate Guitar: The Largest Song Library Available

Ultimate Guitar home page

Ultimate Guitar benefits from a huge community of guitarists who contribute chords and tabs to the website. You will also find several different versions of the songs to practice with too.

Search for songs using the track name or artist, or click the chord button in search bar to search for particular chords. That way, if you’re new to guitar, it’s super easy to find songs you can already play by searching the chords you already know.

Users can rate the guitar chords and tabs out of five, making it clear which version is the best. What’s more, sign up to Ultimate Guitar Pro to get access to professional guitar chords and lyrics, which are always accurate.

Ultimate Guitar also features music news, reviews, articles, and interviews. Take a look at the most popular recent guitar chords and tabs or browse through the top 100 tabs of all time to start learning some classics.

Guitar Chords for “You and I” on Ultimate Guitar

Ultimate Guitar website with You and I Guitar Chords

Let’s walk you through an example of finding guitar chords and lyrics on Ultimate Guitar. Get started by searching for the song you want to learn. In this example, we searched for “You and I” by One Direction.

Filter your search results with the Chords button, then sort them by High rated. If there are several different versions for your song, start with the highest rated one.

When you click the version you want, you should see a combination of guitar chords, tabs, and lyrics. Sometimes there’s also an explanation for how to play the song. In the “You and I” version we chose, there was a link to a performance on YouTube as well.

Hover your mouse over each chord name to see a diagram showing how to play it. You can hear how it should sound and even use the arrow button to see alternate fingerings. If you want to sing along, transpose the song to a key that’s comfortable for you.

When you’re ready to play, click the Auto-scroll button at the bottom of the screen.

2. Chordify: Play Along With the Recording

Chordify home page

Sometimes, you want to learn a particular song even if you don’t know how it goes that well. Chordify is perfect for those situations. This website features a super clean interface with large chord diagrams that update as the song plays in real-time.

Hit the play button and grab your guitar. Chordify loads a YouTube video in the corner and starts playing the actual recording. The display in the center of the screen shows a square box for each bar and tells you when to change to the next chord.

If anything, it’s all a little bit too simple. There’s no information about strumming patterns and Chordify doesn’t offer alternate chord fingerings, even if the song needs them. There are no lyrics too. But it’s a great place to get started.

Also, if you sign up for a monthly subscription, you can unlock tools to change the tempo, volume, and pitch of the song as you play along with it.

Guitar Chords for “Can’t You See” on Chordify

Chordify page showing Can't You See Guitar Chords

Let’s find guitar chords for the song “Can’t You See” by the Marshall Tucker Band.

Search the song or artist you want to play, then click the song from the list of results. There’s only one version available for each song, which is nice and simple. But not all songs are “Chordified” which means you might not be able to play along.

On the next screen, take a look at the chords you need for the song. When you’re familiar with them, click the Play button and Chordify starts playing the song over YouTube and scrolling through the chords in time.

3. Songsterr: Interactive Tabs or Clean Chords

Songsterr home page

There are two versions of the Songsterr website. The newer version features an interactive player with tabs for over 500,000 songs. Many of the songs on here even let you choose from multiple instrument parts to play.

However, if you’re looking for guitar chords and lyrics to popular songs, rather than tabs, click the button to visit Old Songsterr instead. From here, enter the song title or artist you want to search for, then click the song you want to learn from the results.

Each song on Songsterr has one of three different icons, to show what’s available:

  • The Play button signifies an interactive tab that uses Flash Player.
  • The T indicates a tab written out in text form, which is often trickier to read.
  • And the Chord icon shows songs with the lyrics and chords.

Click the Chord icon to reveal a clean interface with lyrics running down the page and all the chords you need to know on the right. Click each chord to see alternate fingerings.

Guitar Chords for “Just What I Needed” on Songsterr

Songsterr page with Just What I Needed guitar chords

For this example, we’re going to play “Just What I Needed” by The Cars. Search the song name from Songsterr’s old website, then click the Chord icon next to that song from the list of results.

Take a moment to get familiar with the chords in the song, clicking each one to find alternate fingerings if you need them. When you’re ready, follow the lyrics to play the song, changing the chord whenever it’s indicated.

There’s no auto-scroll, backing track, or strumming patterns in Songsterr. So you need to know how the song goes. If you want, find the best audio interface to record yourself with so you can review your performance afterward.

4. Chordie: Search for Chords or Lyrics to Find Songs

Chordie home page

At Chordie, you can search for the song name, artist, lyrics, or chords you want to play. It doesn’t have as big a catalog of free guitar chords as Ultimate Guitar, but Chordie presents chords and lyrics in a super clean interface.

Chordie is built from another community of guitarists, who contribute their time to upload guitar chords and lyrics to different songs. What’s nice about Chordie is there’s only one version of each song, so you don’t need to work through five bad versions first.

When you open a song on Chordie, the chords you need are displayed in the top-right corner. You don’t need to go flipping through a guitar book every time you forget how to play an F chord, just scroll back to the top of the page.

Chordie also gives you simple tools to change the font size, transpose to a different key, adjust the chords based on your capo placement, and auto-scroll while you play along. The clean interface includes a tab section for important riffs as well.

Guitar Chords for “This Is It” on Chordie

Chordie page showing This Is It guitar chords

Now, play the song “This Is It” by Ryan Adams. If you don’t remember the name of a song, just search for any of the lyrics you can remember. We searched “She kisses when she sleeps” to find our song.

Click the song you want from the search results and get familiar with the guitar chords. Take a moment to learn any tabbed out sections of the song. Then use the tools to transpose to a key that’s easy for you to sing in.

When you’re ready to play, click the scroll button and choose a speed to auto-scroll at.

5. E-Chords: A Simple Interface With Lots of Tools

E-Chords home page

The E-Chords home page features video lessons, new tabs, tutorials, and highlighted blogs. Search for songs, artists, or lyrics to find the free guitar chords you’re looking for. Then open them up into a clean page with lots of useful tools running down the left side.

You can customize how the songs look by choosing simplified chords, changing the color of links, and even clicking and dragging chords to where you want them beside the lyrics. Hover your mouse over a chord name above the lyrics to see how to play it.

The verses and choruses are separated, making it easy to learn the structure of a song with just a quick glance. All the chords you need are listed at the bottom of the page as well, so spend a moment there to learn the song before you get started.

Guitar Chords for “The Greatest Show” on E-Chords

E-Chords page showing The Greatest Show Guitar Chords

Let’s find chords to “The Greatest Show” from the soundtrack to The Greatest Showman. Search for the song name or any of the lyrics to get started. Then hover your mouse over the instrument icons in the results to check if guitar chords are available for that song.

Click the song and start learning the chords from the bottom of the page. If you ever forget one, just hover over the chord name again to see a chord diagram. You can even pin diagrams beside certain lyrics and display them while you play along.

Use the tools on the left of the screen to set your scroll speed, change the font size, change the color, or simplify the chords to your liking.

6. Heartwood Guitar: Accurate Curated Chord Charts

Heartwood Guitar home page

Heartwood Guitar doesn’t feature a giant library with thousands of guitar chords and lyrics, but it does have a curated selection of accurate guitar chords and lyrics to the most popular songs.

In fact, the site has a lot of free resources for learning how to play the guitar well.

Major kudos to Rob Hampton of Seattle for creating this impressive and useful online resource. There are over 600 free guitar chord charts available or you can subscribe to get access to tutorial videos and exclusive lessons.

Click on Chord Charts to see an alphabetical list of the available songs. Each one has accurate lyrics and guitar chords, with loads of detail explaining how to play the song. It may look intimidating at first, but before long you’ll be playing like a pro.

These chord listings are nicely laid out with chord and strumming information listed at the top of the page. There aren’t fancy tools like auto-scroll or transcribe, but you don’t need them when you’ve got such an accurate chord chart to follow instead.

Guitar Chords for “Space Oddity” on Heartwood Guitar

Heartwood Guitar chord chart for Space Oddity

For our last song, let’s learn to play “Space Oddity” by David Bowie. Click the Chord Charts button then scroll down to the B section to find Bowie. Click Space Oddity and brace yourself to learn an awesome song.

The chord chart opens with information about the chords you need to use along with how to play the strumming pattern. Take a moment getting familiar with this before scrolling down to see the guitar chords and lyrics together.

Chords appear above the lyrics. If you need to, play the song from Apple Music or Spotify to learn how it’s supposed to sound.

Find the Right Apps to Improve Your Playing

You’ve got an entire world of popular songs to learn the guitar chords and lyrics for, and you can do it all for free. But don’t stop there, put your technology to good use and find the best apps to improve your guitar playing as well.

Read the full article: The 6 Best Websites to Find Guitar Chords for Songs

non critical

via MakeUseOf.com https://ift.tt/1AUAxdL

December 13, 2019 at 10:50AM

How a Tesla Valve Works

How a Tesla Valve Works

https://ift.tt/2YJC3Rn

How a Tesla Valve Works

Link

Invented by Nikola Tesla, this ingenious type of valve uses a series of teardrop-shaped channels to restrict the flow of gases going one direction, by allowing smooth flow the other direction. NightHawkInLight built one such valve and demonstrates how it works by igniting propane gas flowing through it.

fun

via The Awesomer https://theawesomer.com

December 12, 2019 at 12:34PM

In The Witcher’s Final Trailer, a World Prepares for Magic and War

In The Witcher’s Final Trailer, a World Prepares for Magic and War

https://ift.tt/2EbSBrT

That coat is made for looking fabulous… and fighting baddies.
Image: Netflix (YouTube)

Trailer FrenzyA special place to find the newest trailers for movies and TV shows you’re craving.

The great war is about to begin, but all that matters is one girl.

The final trailer has arrived for Netflix’s The Witcher, bringing Geralt of Rivia (Henry Cavill) and Yennefer the sorceress (Anya Chalotra) into the fray as they battle monsters and humans alike to protect a young woman who might be the key to saving or destroying them all.

The latest and final trailer focuses on a massive war being waged by Nilfgaard, a large and thriving country that built a global empire throughout the world of The Witcher by invading and taking over foreign countries, establishing them as provinces of the great Nilfgaardian Empire.

As the North struggles to fight back, there’s also the matter of protecting Ciri (Freya Allan), a princess with strange abilities that could change the course of the world. It’s up to Geralt and Yennefer to protect her from Nilfgaard and any other foes that could threaten her safety—but first they’ve got to find out where she’s gone. Through all that, one thing is clear: Don’t touch Roach.

The Witcher debuts its first eight-episode season on Netflix December 20. It’s already been renewed for season two, which arrives sometime in 2021.


For more, make sure you’re following us on our Instagram @io9dotcom.

geeky,Tech

via Gizmodo https://gizmodo.com

December 12, 2019 at 11:36AM

Episode 752 Scott Adams: Let Me Tell You How Much I HATE My Government Today, IG Report, Impeachment

Episode 752 Scott Adams: Let Me Tell You How Much I HATE My Government Today, IG Report, Impeachment

https://ift.tt/38m7DcF


My new book LOSERTHINK, available now on Amazon https://tinyurl.com/rqmjc2a

Content:

  • FBI was massively incompetent…but unbiased, per IG Horowitz
  • President Trump comes down hard on FBI Director Wray
  • The impeachment proceeding is complete BS, here’s why
  • ONLY Rep Crenshaw found the SIMPLE narrative
  • Matt Gaetz annihilates Goldman for his tweets
  • Berke’s intentionally misleading, out of context video
  • dismissing each article of impeachment with a tweet-sized sentence

If you would like my channel to have a wider audience and higher production quality, please donate via my startup (Whenhub.com) at this link: 

I use donations to pay for the daily conversions of the original Periscope videos into Youtube and podcast form, and to improve my production quality and search results over time.

The post Episode 752 Scott Adams: Let Me Tell You How Much I HATE My Government Today, IG Report, Impeachment appeared first on Scott Adam’s Blog.

thinkers

via Scott Adam’s Blog https://ift.tt/2ke54Vz

December 10, 2019 at 11:55AM

Crater: Open-Source Laravel Invoicing App

Crater: Open-Source Laravel Invoicing App

https://ift.tt/2PbmP4N

Crater: Open-Source Laravel Invoicing App

Crater is a free, open-source invoice app for freelancers and small businesses made with Laravel 6.x, VueJS, and Bootstrap 4. It’s core features include:

  • Invoices
  • Estimates
  • Payment Tracking
  • Expenses
  • Reporting
  • Taxes

Along with these features, Crater has a dashboard that summarizes things like sales and expenses, invoices due, and recent estimates:

Crater also provides a mobile app that works with your self-hosted Crater app. At the time of writing, Crater has an Android app with an iOS version in the works.

Crater has end-user documentation and setup instructions on docs.craterapp.com. If you’d like to reference the source code, check out bytefury/crater on GitHub. There’s plenty of real-world Laravel and VueJS code you can reference.


Filed in: News


Enjoy this? Get Laravel News delivered straight to your inbox every Sunday.

No Spam, ever. We’ll never share your email address and you can opt out at any time.

programming

via Laravel News https://ift.tt/14pzU0d

December 10, 2019 at 09:12AM

The 6 Best Free Bulletin Boards to Set Up Your Own Forum

The 6 Best Free Bulletin Boards to Set Up Your Own Forum

https://ift.tt/2LBKpFm

security-forums

Want to have your own forum? Well, it doesn’t have to be expensive or complicated to create. There are paid forum software available, but you can pick a free alternative that is of equal or better quality.

A forum, sometimes called a bulletin board, is a great way to create a community of like-minded people. Online bulletin boards are packed with features and their interface is designed to encourage chatter.

Let’s take a look at the best free bulletin boards you can find today.

What Is a Self-Hosted Forum?

We are going to talk about bulletin board forums that are self-hosted. This means you are installing the forum software on your own website. You are responsible for the cost of server storage and the domain. Bear in mind that if your community grows large, the cost of storage will increase.

Running a self-hosted forum, as opposed to one managed by a third party, has many benefits: You are in total control of your data, aren’t forced to display adverts or pay for some features, and can often customize them much more too.

Some self-hosted forums can be a bit tricky to install, but all the services listed below have great documentation and support pages to help you out. You should also look to see if your hosting provider offers one-click installation of a forum software—many of the well-known hosts do.

1. phpBB

phpBB forum

For more than two decades, phpBB has been considered the premier free bulletin board for users across the globe. It’s a shining example of the quality open-source development can lead to and is still in active development.

Perhaps the biggest advantage of phpBB is its popularity. It’s likely that someone has already tried to do whatever you’re thinking of doing with your forum, whether that’s in functionality or design. It’s very easy to install something from the extensive user-created extension database.

Its administration panel is wonderfully simple and comprehensive. You don’t require any programming knowledge to start creating categories and boards, editing user group permissions, install themes, and more. You’ll be up and running in no time.

2. MyBB

MyBB forum

MyBB has been around for many years, but it continues to evolve. It’s packed with awesome features, but it manages to maintain excellent speed. Not only that, but it works behind the scenes to keep the database in good shape.

MyBB has a built-in user reputation support, excellent calendar features, multi-quote, and quick reply. You can also embed media, send private messages, and so much more.

You can edit color schemes using a simple editor. Alternatively, you can dive right into the CSS for some advanced customization. It only takes minutes to install plugins, which can be handily updated via the admin panel.

3. Simple Machines Forum

Simple Machines Forum

Simple Machine Forum (SMF) first released in 2003, created as a spin-off from the now defunct YaBB SE software. Despite its age, SMF continues to receive regular updates. While it’s laid out like a classic bulletin board, it still has a fresh feel.

If you’re looking for a free bulletin board with an excellent interface, SMF is likely your best choice. SMF has an excellent default style and easy to navigate admin panel that provides a lot of information in minimal space.

SMF also has a modification database that includes a wide variety of add-ons that can be used to change the bulletin board. This includes everything from added emojis to search engine optimization to social networking features.

4. Vanilla

Vanilla forum

Vanilla primarily targets business customers with its cloud-based solution. Nevertheless, the open source version still remains a great choice, especially if you want to embed a forum within your existing website because you can use it as a forum and a commenting system.

It supports social media log in, single sign-on, and you can also import from other forums. It’s less feature-rich compared to some other providers but makes for a great, simple forum platform.

The only downside is that features for paid users are often not given to those running the free, open source version. That said, many of these eventually become available through plugins from community members.

5. Discourse

Discourse forum

Discourse is the most modern forum software on this list. It doesn’t look like a traditional bulletin board, but it’s designed for modern web browsing habits. As such, conversations aren’t broken into pages—there’s an endless scroll, with a handy bar showing where you are in the discussion.

Other features include dynamic notifications (similar to Facebook tagging), automatically expanded embedded media, single sign-on, social login, community moderation, mobile optimization… and that’s just scratching the surface.

Discourse can take a bit of getting used to and isn’t easily modifiable, especially if you’re more familiar with the traditional forum software. Nevertheless, Discourse can be customized with themes and there are a few plugins available, like Patreon and advertising integration.

6. FluxBB

FluxBB forum

FluxBB is a bit different from the other software listed here. It prides itself on being a lighter, faster alternative. It’s simple to use and has a nice, clean interface, making it a breeze to navigate around and get right into the discussions.

While it does have fewer features than other software, it still has everything you’d expect from a forum in terms of posting and splitting by category and board. There are also moderation tools and a permission system to control user groups.

You can customize the theme, but only on a basic level. And there aren’t many styles available on the community market. That said, there are ample plugins, meaning you can extend the functionality to include image upload, SEO support, and more.

Use a Remotely Hosted Forum Instead

Which of these forum software packages you choose depends on your needs. For example, some prefer SMF because it looks professional out of the box, while others like phpBB because of its huge community. No matter which you choose, you can’t go too wrong. You can always take ideas from many free message boards that are popular.

If you’ve decided that hosting your own forum independently isn’t right for you, consider using a remotely hosted forum provider.

Read the full article: The 6 Best Free Bulletin Boards to Set Up Your Own Forum

non critical

via MakeUseOf.com https://ift.tt/1AUAxdL

December 9, 2019 at 04:46PM

How to encrypt & upload large files to Amazon S3 in Laravel

How to encrypt & upload large files to Amazon S3 in Laravel

https://ift.tt/2QmSQqB

Creating Queueable Jobs

Next, let’s create the two queueable jobs that we use for encryption and uploading to S3:

php artisan make:job EncryptFilephp artisan make:job MoveFileToS3

This will create two files in app/Http/Jobs : EncryptFile.php and MoveFileToS3.php. These jobs will accept a param in the constructor, which represents the filename. We add the functionality of encrypting and uploading to S3 in the handle method. This is what the two jobs look like:

<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use SoareCostin\FileVault\Facades\FileVault;

class EncryptFile implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

protected $filename;

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

/**
* Execute the job.
*
* @return void
*/
public function handle()
{
FileVault::encrypt($this->filename);
}
}
<?php

namespace App\Jobs;

use Exception;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Http\File;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Storage;

class MoveFileToS3 implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

protected $filename;

/**
* Create a new job instance.
*
* @return void
*/
public function __construct($filename)
{
$this->filename = $filename . '.enc';
}

/**
* Execute the job.
*
* @return void
*/
public function handle()
{
// Upload file to S3
$result = Storage::disk('s3')->putFileAs(
'/',
new File(storage_path('app/' . $this->filename)),
$this->filename
);

// Forces collection of any existing garbage cycles
// If we don't add this, in some cases the file remains locked
gc_collect_cycles();

if ($result == false) {
throw new Exception("Couldn't upload file to S3");
}

// delete file from local filesystem
if (!Storage::disk('local')->delete($this->filename)) {
throw new Exception('File could not be deleted from the local filesystem ');
}
}
}

As you can see, the EncryptFile job is simple — we are just using the FileVault package to encrypt a file and save it into the same directory, with the same name and the .enc extension. It’s exactly what we were doing before, in the HomeController’s store method.

For the MoveFileToS3 job, we are first using the Laravel putFileAs method that will automatically stream our file to S3, following the same directory convention as we had on the local filesystem.

We are then calling the PHP gc_collect_cycles function, in order to force collection of any existing garbage cycles. In some cases, if we don’t run this function then the file will remain locked and we won’t be able to delete it in the next step.

Finally, we are deleting the file from the filesystem and throwing Exceptions if the upload or the delete processes fail.

programming

via Laravel News Links https://ift.tt/2dvygAJ

December 9, 2019 at 09:00AM

Redirect www to non-www url’s in Laravel

Redirect www to non-www url’s in Laravel

https://ift.tt/2w4aNU6

I want my site to show as robindirksen.nl and not www.robindirksen.nl in the search results or ay other place, but how do you handle the removal of www in your application so you don’t lose your visitors?

There are a few ways how you can solve this. I recommend the server side (for example nginx or htaccess) above application based redirects (for example Laravel) because these will also redirect static files to the non-www version of your site.

Nginx configuration

You can make a new configuration in your configuration directory, this is usually in the /etc/nginx/conf.d/ directory. You can make a file (for example: /etc/nginx/conf.d/redirect.conf) and place the following configuration:

server { server_name www.robindirksen.nl; return 301 $scheme://robindirksen.nl$request_uri; } 

This will redirect everything that requests www.robindirksen.nl to the non-www version, robindirksen.nl.

.htaccess file

In a Laravel application you will find a .htaccess file in your public folder. Here you can add the following code to redirect the visitors.

RewriteEngine On RewriteCond %{HTTP_HOST} ^www.robindirksen.nl$ [NC] RewriteRule ^(.*)$ http://robindirksen.nl/$1 [R=301,L] 

To enable redirect you have to install mod_rewrite to the server and switch RewriteEngine to on.

Laravel Application

One of the ways to do this is by making a middleware and enable this to all your requests.

<?php namespace App\Http\Middleware; use Closure; use Illuminate\Support\Facades\Redirect; class RedirectToNonWwwMiddleware { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (substr($request->header('host'), 0, 4) == 'www.') { $request->headers->set('host', 'robindirksen.nl'); return Redirect::to($request->path()); } return $next($request); } } 

After you’ve made your middleware you need to add it to the requests, this can be done by adding it to all of the requests (web, api etc) or only the web.

To add it to all of your requests, you can add the middleware (\App\Http\Middleware\TrustProxies::class) to the $middleware array, then it will look sometime like this:

<?php namespace App\Http; use Illuminate\Foundation\Http\Kernel as HttpKernel; class Kernel extends HttpKernel { /** * The application's global HTTP middleware stack. * * These middleware are run during every request to your application. * * @var array */ protected $middleware = [ \App\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, \App\Http\Middleware\TrustProxies::class, ]; 

It’s also possible to only add it to the web-group requests (and not your api endpoints). With a basic Laravel 6 installation it will be added to all the requests made to the routes defined in routes/web.php.

<?php namespace App\Http; use Illuminate\Foundation\Http\Kernel as HttpKernel; class Kernel extends HttpKernel { /** * The application's route middleware groups. * * @var array */ protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, // \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, \App\Http\Middleware\HttpsProtocolMiddleware::class, \App\Http\Middleware\RedirectToNonWwwMiddleware::class ], 'api' => [ ... ], ]; } 

Please pay attention, when you have likes to static files (like images, css or javascript) you have to enable htaccess or nginx redirects, otherwise those keep be served from the www version. This happens because the static files won’t boot the framework what means it don’t received the redirect.

Which status code do I need to use?

Last but not least, which redirect http code do you need to use? It’s really simple, you want to permanently show your non-www site in the results, then you redirect with a 301 status code.

Sometimes it can happen to only redirect the users for a specific time to another url, then you want a temporarily redirect. This can be done by redirecting with a 302 status code.

programming

via Laravel News Links https://ift.tt/2dvygAJ

December 9, 2019 at 09:00AM