Skip to content

Instantly share code, notes, and snippets.

@themodernpk
Created December 26, 2022 11:45
Show Gist options
  • Save themodernpk/8cf496c41cf8701bb8e50d2202129206 to your computer and use it in GitHub Desktop.
Save themodernpk/8cf496c41cf8701bb8e50d2202129206 to your computer and use it in GitHub Desktop.

Guideline: Method name should typically be in camelCase, with the first character lower case

Topic Details
Source Link Laravel Naming Conventions
Guideline Followed: :badge[No]{type="danger"}
Details: Methods in your models in Laravel projects, like all methods in your Laravel projects, should be camelCase with the first character lower case.
GitHub Link City.php

::badge{type="danger"} Bad Code ::

<?php
public static function full_city_list()
{
    $city = Self::pluck('name','id')->toArray();
    return $city;
}

::badge{type="success"} Correct Code ::

public static function full_city_list()
{
    $city = Self::pluck('name','id')->toArray();
    return $city;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment