DEV Community

Mohammad Qandeell
Mohammad Qandeell

Posted on

Laravel helper function

As you know, Laravel is a modern, leading-edge framework for PHP developers
I also seemed to learn it. I wanted to share with you 2 "helper" function That you should not be ignorant of them as laravel developer.

dd()helper function

The full form of dd is "Dump and Die" that's mean your script will dump a variable then will die.it's useful when tracing your code searching for the error.

dd($value);

slug()helper function

In case you are building a blog website, you should pay attention to improving search engine results "SEO", which rely heavily on the SLUG
Laravel comes with a SLUG helper function that accepts a string and returns a link.
This usually used when saving the article or news we use the SLUG helper function to get the clean URL from the title of post or news

use Illuminate\Support\Str;

$slug = Str::of('your blog title')->slug('-'); // your-blog-title

Top comments (0)