Skip to content

Commit 37eccee

Browse files
committed
Initial commit
1 parent b72b92a commit 37eccee

File tree

7 files changed

+119
-2
lines changed

7 files changed

+119
-2
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.

.github/pull_request_template.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### Description
2+
3+
Explain what are you submitting.
4+
5+
### Fixes
6+
7+
Enter the issue you are fixing (e.g. This fixes #1.).
8+
9+
10+
11+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.idea

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# laravel-publishable
2-
Laravel package for handling publishable resources
1+
# Laravel Publishable
2+
3+
Laravel package for handling publishable resources.

composer.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "codetech/laravel-publishable",
3+
"description": "Laravel package for handling publishable resources.",
4+
"authors": [
5+
{
6+
"name": "José Osório",
7+
"email": "jfrosorio@gmail.com",
8+
"role": "Developer"
9+
}
10+
],
11+
"license": "MIT",
12+
"require": {
13+
"php": "^7.2",
14+
"laravel/framework": "~6.0"
15+
},
16+
"autoload": {
17+
"psr-4": {
18+
"CodeTech\\Publishable\\": "src/"
19+
}
20+
},
21+
"minimum-stability": "dev",
22+
"prefer-stable": true
23+
}

src/Publishable.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace CodeTech\Publishable;
4+
5+
use Illuminate\Database\Eloquent\Builder;
6+
7+
trait Publishable
8+
{
9+
/**
10+
* Initializes the trait.
11+
*/
12+
public function initializePublishable()
13+
{
14+
$this->fillable[] = 'published';
15+
16+
$this->casts['published'] = 'boolean';
17+
}
18+
19+
/**
20+
* Scope a query to only include popular users.
21+
*
22+
* @param Builder $query
23+
* @return Builder
24+
*/
25+
public function scopePublished(Builder $query)
26+
{
27+
return $query->where('published', true);
28+
}
29+
}

0 commit comments

Comments
 (0)