In this tutorial, we will learn Laravel str title() function Example


Example:


<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\FileController;
use Illuminate\Support\Str;

class HomeController extends Controller
{
    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function index()
    {
        $converted1 = Str::title('a nice title uses the correct case');
        \Log::info($converted1);
        // output - A Nice Title Uses The Correct Case

        $converted2 = Str::title('laravel str title() function example');
        \Log::info($converted2);
        // output - Laravel Str Title() Function Example
    }
}

May this example help you.