How to Check If a String Ends with a Specific Word in Laravel 9
In this lesson, we are going to see how to check if a string ends with a specific word in Laravel 9, the endsWith helper method is used to check if a string ends with a specific word.
The Str::endsWith helper method
The endsWith() method checks if a string ends with a specific word if yes it returns true otherwise it returns false.
use Illuminate\Support\Str;
Str::endsWith('Darija coding', 'coding');
// true