{"id":42864333,"url":"https://github.com/jaymeh/laravel-publishable","last_synced_at":"2026-01-30T12:43:22.110Z","repository":{"id":52280347,"uuid":"98784885","full_name":"jaymeh/laravel-publishable","owner":"jaymeh","description":"Toggle the published state of your Eloquent models easily","archived":false,"fork":false,"pushed_at":"2025-03-31T14:24:00.000Z","size":88,"stargazers_count":22,"open_issues_count":4,"forks_count":11,"subscribers_count":1,"default_branch":"5.x","last_synced_at":"2025-10-14T11:46:45.330Z","etag":null,"topics":["eloquent","laravel","publishable","publishing","trait"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaymeh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-07-30T08:28:42.000Z","updated_at":"2025-03-31T14:24:03.000Z","dependencies_parsed_at":"2022-08-23T21:00:20.146Z","dependency_job_id":null,"html_url":"https://github.com/jaymeh/laravel-publishable","commit_stats":{"total_commits":51,"total_committers":4,"mean_commits":12.75,"dds":0.3529411764705882,"last_synced_commit":"7c334402f25324b12671cb5215d5a3ec422407e7"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/jaymeh/laravel-publishable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaymeh%2Flaravel-publishable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaymeh%2Flaravel-publishable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaymeh%2Flaravel-publishable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaymeh%2Flaravel-publishable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaymeh","download_url":"https://codeload.github.com/jaymeh/laravel-publishable/tar.gz/refs/heads/5.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaymeh%2Flaravel-publishable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28912915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T12:13:43.263Z","status":"ssl_error","status_checked_at":"2026-01-30T12:13:22.389Z","response_time":66,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eloquent","laravel","publishable","publishing","trait"],"created_at":"2026-01-30T12:43:20.752Z","updated_at":"2026-01-30T12:43:22.106Z","avatar_url":"https://github.com/jaymeh.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Publishable\n\nToggle the published state of your Eloquent models easily.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require pawelmysior/laravel-publishable\n```\n\n## Versions\n\nFor details about which version of this package to use with your Laravel version please see the table below:\n\n| Laravel Version | Package Version |\n| --------------- | --------------- |\n| \u003c9.x            | 1.x             |\n| 9.x             | 2.x             |\n| 10.x            | 3.x             |\n| 11.x            | 4.x             |\n| 12.x            | 5.x             |\n\n## Preparation\n\nTo start you need to add a `published_at` nullable timestamp column to your table.\n\nPut this in your table migration:\n\n```php\n$table-\u003etimestamp('published_at')-\u003enullable();\n```\n\nNow use the trait on the model\n\n```php\n\u003c?php\n \nnamespace App;\n  \nuse Illuminate\\Database\\Eloquent\\Model;\nuse PawelMysior\\Publishable\\Publishable;\n \nclass Post extends Model\n{\n    use Publishable;\n}\n```\n\n## Add Fillable Attribute\n\nIn Version 1.x, the `published()` function handles the update in a way where Laravel expects that the `published_at` field is fillable. As of Version 2.x, we not use fill functionality so the fillable attribute is no longer required.\n\n## Usage\n\nYou can now use those features:\n\n```php\n// Get only published posts\nPost::published()-\u003eget();\n \n// Get only unpublished posts\nPost::unpublished()-\u003eget();\n \n// Check if the post is published\n$post-\u003eisPublished();\n \n// Check if the post is unpublished\n$post-\u003eisUnpublished();\n \n// Publish the post\n$post-\u003epublish();\n \n// Unpublish the post\n$post-\u003eunpublish();\n\n// Publish the post without firing model events\n$post-\u003epublishQuietly();\n \n// Unpublish the post without firing model events\n$post-\u003eunpublishQuietly();\n```\n\nA post is considered published when the `published_at` is not null and in the past.\n\nA post is considered unpublished when the `published_at` is null or in the future.\n\n## Security\n\nIf you discover any security-related issues, please email security@jaymeh.co.uk instead of using the issue tracker.\n\n## Contributing\n\nAny contributions to this repository are welcomed. Please be aware that we are using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) to assist in self documentation and reduce manual work involved with releases.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaymeh%2Flaravel-publishable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaymeh%2Flaravel-publishable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaymeh%2Flaravel-publishable/lists"}