Skip to content

Commit

Permalink
Merge pull request #13 from michaelnabil230/upgrade-to-laravel-10
Browse files Browse the repository at this point in the history
Upgrade package
  • Loading branch information
michaelnabil230 authored Feb 22, 2023
2 parents 2591571 + 97b219c commit 12c1d2a
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 140 deletions.
66 changes: 66 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Bug Report
description: Report an Issue or Bug with the Package
title: "[Bug]: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
We're sorry to hear you have a problem. Can you help us solve it by providing the following details.
- type: textarea
id: what-happened
attributes:
label: What happened?
description: What did you expect to happen?
placeholder: I cannot currently do X thing because when I do, it breaks X thing.
validations:
required: true
- type: textarea
id: how-to-reproduce
attributes:
label: How to reproduce the bug
description: How did this occur, please add any config values used and provide a set of reliable steps if possible.
placeholder: When I do X I see Y.
validations:
required: true
- type: input
id: package-version
attributes:
label: Package Version
description: What version of our Package are you running? Please be as specific as possible
placeholder: 2.0.0
validations:
required: true
- type: input
id: php-version
attributes:
label: PHP Version
description: What version of PHP are you running? Please be as specific as possible
placeholder: 8.2.0
validations:
required: true
- type: input
id: laravel-version
attributes:
label: Laravel Version
description: What version of Laravel are you running? Please be as specific as possible
placeholder: 9.0.0
validations:
required: true
- type: dropdown
id: operating-systems
attributes:
label: Which operating systems does with happen with?
description: You may select more than one.
multiple: true
options:
- macOS
- Windows
- Linux
- type: textarea
id: notes
attributes:
label: Notes
description: Use this field to provide any other notes that you feel might be relevant to the issue.
validations:
required: false
3 changes: 0 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@ contact_links:
- name: Report a security issue
url: https://github.com/michaelnabil230/laravel-setting/security/policy
about: Learn how to notify us for sensitive bugs
- name: Report a bug
url: https://github.com/michaelnabil230/laravel-setting/issues/new
about: Report a reproducible bug
7 changes: 5 additions & 2 deletions .github/workflows/fix-php-code-style-issues.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Fix PHP code style issues

on: [push]
on:
push:
paths:
- "**.php"

jobs:
php-code-styling:
Expand All @@ -13,7 +16,7 @@ jobs:
ref: ${{ github.head_ref }}

- name: Fix PHP code style issues
uses: aglipanci/laravel-pint-action@1.0.0
uses: aglipanci/laravel-pint-action@2.1.0

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.0, 8.1]
laravel: [8.*, 9.*]
stability: [prefer-stable]
php: [8.2, 8.1]
laravel: [10.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 8.*
testbench: ^6.25
- laravel: 9.*
testbench: 7.*
- laravel: 10.*
testbench: 8.*
carbon: ^2.63

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

Expand All @@ -38,10 +37,10 @@ jobs:
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: List installed dependencies
- name: List Installed Dependencies
run: composer show -D

- name: Execute tests
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This package allows you to persist in setting for Laravel projects and support laravel 8 & 9.
# This package allows you to persist in setting for Laravel projects and support laravel 10.

[![Latest Version on Packagist](https://img.shields.io/packagist/v/michaelnabil230/laravel-setting.svg)](https://packagist.org/packages/michaelnabil230/laravel-setting)
[![Total Downloads](https://img.shields.io/packagist/dt/michaelnabil230/laravel-setting.svg)](https://packagist.org/packages/michaelnabil230/laravel-setting)
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@
}
],
"require": {
"php": "^8.0",
"illuminate/contracts": "^8.73|^9.0",
"spatie/laravel-package-tools": "1.11.0"
"php": "^8.1",
"spatie/laravel-package-tools": "^1.14.0",
"illuminate/contracts": "^10.0"
},
"require-dev": {
"laravel/pint": "^1.0",
"nunomaduro/collision": "^5.10|^6.0",
"nunomaduro/larastan": "^1.0|^2.2.5",
"orchestra/testbench": "^6.22|^7.0",
"laravel/pint": "^1.2",
"nunomaduro/collision": "^6.1",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^1.21",
"pestphp/pest-plugin-laravel": "^1.1",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.6"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -79,4 +79,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
19 changes: 5 additions & 14 deletions src/Interfaces/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ public function get($key, $default = null);

/**
* Loaded data from the store.
*
* @return void
*/
public function loadedData(): void;

Expand All @@ -32,10 +30,9 @@ public function set($key, $value = null);
/**
* Determine if a key exists in the settings data.
*
* @param string $key
* @return bool
*/
public function has($key);
public function has(string $key);

/**
* Save any changes done to the settings data.
Expand All @@ -47,7 +44,6 @@ public function save();
/**
* Write the data into the store.
*
* @param array $data
* @return void
*/
public function write(array $data);
Expand All @@ -64,34 +60,30 @@ public function all();
*
* This method exists for convenience.
*
* @param mixed $key
* @return $this
*/
public function flip($key);
public function flip(mixed $key);

/**
* Sets the specified key to true.
*
* @param mixed $key
* @return $this
*/
public function enable($key);
public function enable(mixed $key);

/**
* Sets the specified key to false.
*
* @param mixed $key
* @return $this
*/
public function disable($key);
public function disable(mixed $key);

/**
* Unset a key in the settings data.
*
* @param string $key
* @return bool
*/
public function forget($key);
public function forget(string $key);

/**
* Unset all keys in the settings data.
Expand All @@ -103,7 +95,6 @@ public function forgetAll();
/**
* Set extra columns to be added to the rows.
*
* @param array $columns
* @return $this
*/
public function setExtraColumns(array $columns);
Expand Down
2 changes: 0 additions & 2 deletions src/SettingManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public function getDefaultDriver()
/**
* Register a new store.
*
* @param string $driver
* @param array $params
* @return self
*/
public function register(string $driver, array $params)
Expand Down
29 changes: 2 additions & 27 deletions src/Stores/DatabaseSettingStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,8 @@ class DatabaseSettingStore extends SettingStore

/**
* SettingStore constructor.
*
* @param array $options
* @return void
*/
public function postOptions($options = []): void
public function postOptions(array $options = []): void
{
$this->model = $options['model'];
$this->cache = $this->app['cache'];
Expand All @@ -69,9 +66,6 @@ public function postOptions($options = []): void

/**
* Write the data into the store.
*
* @param array $data
* @return void
*/
public function write(array $data): void
{
Expand All @@ -90,8 +84,6 @@ public function write(array $data): void

/**
* Loaded data from the store.
*
* @return void
*/
public function loadedData(): void
{
Expand All @@ -108,11 +100,8 @@ public function loadedData(): void

/**
* Unset a key in the settings data.
*
* @param string $key
* @return bool
*/
public function forget($key): bool
public function forget(string $key): bool
{
$this->loadedData();

Expand All @@ -133,8 +122,6 @@ public function forget($key): bool

/**
* Unset all keys in the settings data.
*
* @return bool
*/
public function forgetAll(): bool
{
Expand All @@ -148,7 +135,6 @@ public function forgetAll(): bool
/**
* Set extra columns to be added to the rows.
*
* @param array $columns
* @return $this
*/
public function setExtraColumns(array $columns): self
Expand All @@ -160,9 +146,6 @@ public function setExtraColumns(array $columns): self

/**
* Sync the deleted records.
*
* @param array $deleted
* @return void
*/
private function syncDeleted(array $deleted): void
{
Expand All @@ -173,8 +156,6 @@ private function syncDeleted(array $deleted): void

/**
* Read the original data from dataBase.
*
* @return array
*/
private function readOriginalData(): array
{
Expand All @@ -183,9 +164,6 @@ private function readOriginalData(): array

/**
* Get the changed settings data.
*
* @param array $data
* @return array
*/
private function getChanges(array $data): array
{
Expand All @@ -207,9 +185,6 @@ private function getChanges(array $data): array
/**
* Transforms settings data into an array ready to be inserted into the database.
* Call array_dot on a multidimensional array before passing it into this method!
*
* @param array $data
* @return array
*/
private function prepareData(array $data): array
{
Expand Down
Loading

0 comments on commit 12c1d2a

Please sign in to comment.