JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr{ gilour

File "Member.php"

Full Path: /var/www/lionsclub/core/app/Models/Member.php
File size: 1.62 KB
MIME-type: text/x-php
Charset: utf-8

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Member extends Model
{
    use HasFactory;

    // Define the table associated with the model
    protected $table = 'members';

    // Specify the fields that are mass assignable
    protected $fillable = [
        'full_name', 'full_address', 'mobile_numbers', 'position', 
        'district', 'dob', 'yoj', 'hc', 'photo', 'profession', 
        'spouse_name', 'blood_group', 'spouse_blood_group', 
        'wedding_date', 'email_id', 'start_date', 'end_date', 'memberid', 'description', 'category', 'sort', 'international', 'slogan'
    ];

    // Optionally, define the fields that should be treated as dates
    protected $dates = [
        'wedding_date'
    ];

    // Mutator to capitalize the first letter of each word in full_name
    public function setFullNameAttribute($value)
    {
        $this->attributes['full_name'] = ucwords(strtolower($value));
    }
       // Accessor to capitalize the first letter of each word in full_name
       public function getCamelCaseNameAttribute()
       {
           return $this->convertToCamelCase($this->attributes['full_name']);
       }
   
       // Helper function to convert to camel case
       private function convertToCamelCase($value)
       {
           // Convert each word to have the first letter capitalized
           return preg_replace_callback(
               '/(?:^|\s|\.)([a-z])/',
               function ($matches) {
                   return strtoupper($matches[0]);
               },
               strtolower($value)
           );
       }
}