Created
July 25, 2023 22:50
-
-
Save catwhocode/664fa7ed50cf45b4b093d0c5eb4b7e0b to your computer and use it in GitHub Desktop.
My Model Template for Custom Table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Branch extends Model | |
{ | |
use HasFactory; | |
// custom table name? | |
protected $table = 'tbl_branch'; | |
// custom ID field? | |
protected $primaryKey = 'branch_id'; | |
// disallow mass assignment to these fields | |
protected $guarded = []; | |
// allow mass-assignment to these fields | |
// protected $fillable = []; | |
// turn off autoincrementing ? | |
// public $incrementing = false; | |
// primary key is not an integer ? | |
// protected $keyType = 'string'; | |
// model will use created_at and updated_at ? | |
public $timestamps = false; | |
// custom field name? | |
// const CREATED_AT = 'creation_date'; | |
// const UPDATED_AT = 'updated_date'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment