Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make timestamp column names easy to change #90

Conversation

thijsvdanker
Copy link
Contributor

@thijsvdanker thijsvdanker commented Mar 4, 2024

Our database schema uses camelCase for column names instead of snake_case.

Eloquent models allow you to change the column names for the timestamp columns and it would be really nice if we could do the same in Pennant.

It would allow us to extend the DatabaseDriver and just change the two constants instead of overriding the getAll() insert() and update() functions.

<?php

namespace App\Extensions;

use Laravel\Pennant\Drivers\DatabaseDriver;

class CustomDatabaseDriver extends DatabaseDriver
{
    const CREATED_AT = 'dateCreated';
    const UPDATED_AT = 'dateModified';
}

By using constants to set the column names for the timestamps it is easier to extend the DatabaseDriver when your database uses a different standard (e.g. camelCase instead of snake_case).
@taylorotwell taylorotwell merged commit c703915 into laravel:1.x Mar 4, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants