Site Admin
Site Admin Founder of MeaningArticles
1262 Views

Laravel str camel() function

Hello Dev.

In this weblog,i will teach you how to use laravel str camel() function instance. we can display instance of camel function in laravel. The Str::camel method converts the given string to camelCase.

here, i can come up with full example for easily str camel() method in laravel as bellow.


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()
    {
        $camel1 = Str::camel('red_apple');
        
        print_r($camel1);
        // output - redApple

        $camel2 = Str::camel('good_tea');
        
        print_r($camel2);
        // output - goodTea 

        $camel3 = Str::camel('super_sunday');

        print_r($camel3);
        // output - superSunday

    }
}

Output

redApple
goodTea
superSunday

i'm hoping it assist you to, thanks for visit my article if you like my article then proportion together with your friend and social platform.