Skip to content

Commit

Permalink
Merge pull request #1 from cleaniquecoders/develop
Browse files Browse the repository at this point in the history
Update Root Namespace
  • Loading branch information
nasrulhazim authored Dec 3, 2023
2 parents 7188a30 + 7c08db8 commit 97e7105
Show file tree
Hide file tree
Showing 21 changed files with 77 additions and 102 deletions.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/bekwoh/laravel-media-secure/discussions/new?category=q-a
url: https://github.com/cleaniquecoders/laravel-media-secure/discussions/new?category=q-a
about: Ask the community for help
- name: Request a feature
url: https://github.com/bekwoh/laravel-media-secure/discussions/new?category=ideas
url: https://github.com/cleaniquecoders/laravel-media-secure/discussions/new?category=ideas
about: Share ideas for new features
- name: Report a security issue
url: https://github.com/bekwoh/laravel-media-secure/security/policy
url: https://github.com/cleaniquecoders/laravel-media-secure/security/policy
about: Learn how to notify us for sensitive bugs
- name: Report a bug
url: https://github.com/bekwoh/laravel-media-secure/issues/new
url: https://github.com/cleaniquecoders/laravel-media-secure/issues/new
about: Report a reproducible bug
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]
php: [8.1, 8.2]
laravel: [10.*]
stability: [prefer-lowest, prefer-stable]
Expand Down
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ All notable changes to `laravel-media-secure` will be documented in this file.

## Added Laravel 10 Support - 2023-02-25

**Full Changelog**: https://github.com/bekwoh/laravel-media-secure/compare/1.0.5...1.1.0
**Full Changelog**: https://github.com/cleaniquecoders/laravel-media-secure/compare/1.0.5...1.1.0

## 1.0.5 - 2022-10-25

**Full Changelog**: https://github.com/bekwoh/laravel-media-secure/compare/1.0.4...1.0.5
**Full Changelog**: https://github.com/cleaniquecoders/laravel-media-secure/compare/1.0.4...1.0.5

## 1.0.4 - 2022-10-15

**Full Changelog**: https://github.com/bekwoh/laravel-media-secure/compare/1.0.3...1.0.4
**Full Changelog**: https://github.com/cleaniquecoders/laravel-media-secure/compare/1.0.3...1.0.4

## 1.0.3 - 2022-10-15

**Full Changelog**: https://github.com/bekwoh/laravel-media-secure/compare/1.0.2...1.0.3
**Full Changelog**: https://github.com/cleaniquecoders/laravel-media-secure/compare/1.0.2...1.0.3

## 1.0.2 - 2022-10-15

**Full Changelog**: https://github.com/bekwoh/laravel-media-secure/compare/1.0.1...1.0.2
**Full Changelog**: https://github.com/cleaniquecoders/laravel-media-secure/compare/1.0.1...1.0.2

## 1.0.1 - 2022-10-15

**Full Changelog**: https://github.com/bekwoh/laravel-media-secure/compare/1.0.0...1.0.1
**Full Changelog**: https://github.com/cleaniquecoders/laravel-media-secure/compare/1.0.0...1.0.1

## 1.0.0 - 2022-10-15

**Full Changelog**: https://github.com/bekwoh/laravel-media-secure/commits/1.0.0
**Full Changelog**: https://github.com/cleaniquecoders/laravel-media-secure/commits/1.0.0
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) bekwoh <[email protected]>
Copyright (c) cleaniquecoders <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Securely display Media

[![Latest Version on Packagist](https://img.shields.io/packagist/v/bekwoh/laravel-media-secure.svg?style=flat-square)](https://packagist.org/packages/bekwoh/laravel-media-secure)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/bekwoh/laravel-media-secure/run-tests?label=tests)](https://github.com/bekwoh/laravel-media-secure/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/bekwoh/laravel-media-secure/Fix%20PHP%20code%20style%20issues?label=code%20style)](https://github.com/bekwoh/laravel-media-secure/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/bekwoh/laravel-media-secure.svg?style=flat-square)](https://packagist.org/packages/bekwoh/laravel-media-secure)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/cleaniquecoders/laravel-media-secure.svg?style=flat-square)](https://packagist.org/packages/cleaniquecoders/laravel-media-secure)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/cleaniquecoders/laravel-media-secure/run-tests?label=tests)](https://github.com/cleaniquecoders/laravel-media-secure/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/cleaniquecoders/laravel-media-secure/Fix%20PHP%20code%20style%20issues?label=code%20style)](https://github.com/cleaniquecoders/laravel-media-secure/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/cleaniquecoders/laravel-media-secure.svg?style=flat-square)](https://packagist.org/packages/cleaniquecoders/laravel-media-secure)

You have documents, but want to limit the access to only logged in users, and also have some other sophisticated / complex rules in order to access the documents, then this package is for you.

Expand All @@ -14,13 +14,13 @@ This package will securely display or download to your media files.
You can install the package via composer:

```bash
composer require bekwoh/laravel-media-secure
composer require cleaniquecoders/laravel-media-secure
```

Add the following in your route file:

```php
use Bekwoh\LaravelMediaSecure\LaravelMediaSecure;
use CleaniqueCoders\LaravelMediaSecure\LaravelMediaSecure;

LaravelMediaSecure::routes();
```
Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "bekwoh/laravel-media-secure",
"name": "cleaniquecoders/laravel-media-secure",
"description": "Securely display Media",
"keywords": [
"bekwoh",
"cleaniquecoders",
"laravel",
"laravel-media-secure"
],
"homepage": "https://github.com/bekwoh/laravel-media-secure",
"homepage": "https://github.com/cleaniquecoders/laravel-media-secure",
"license": "MIT",
"authors": [
{
Expand Down Expand Up @@ -37,16 +37,16 @@
},
"autoload": {
"psr-4": {
"Bekwoh\\LaravelMediaSecure\\": "src",
"Bekwoh\\LaravelMediaSecure\\Database\\Factories\\": "database/factories"
"CleaniqueCoders\\LaravelMediaSecure\\": "src",
"CleaniqueCoders\\LaravelMediaSecure\\Database\\Factories\\": "database/factories"
},
"files": [
"support/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Bekwoh\\LaravelMediaSecure\\Tests\\": "tests"
"CleaniqueCoders\\LaravelMediaSecure\\Tests\\": "tests"
}
},
"scripts": {
Expand All @@ -66,10 +66,10 @@
"extra": {
"laravel": {
"providers": [
"Bekwoh\\LaravelMediaSecure\\LaravelMediaSecureServiceProvider"
"CleaniqueCoders\\LaravelMediaSecure\\LaravelMediaSecureServiceProvider"
],
"aliases": {
"LaravelMediaSecure": "Bekwoh\\LaravelMediaSecure\\Facades\\LaravelMediaSecure"
"LaravelMediaSecure": "CleaniqueCoders\\LaravelMediaSecure\\Facades\\LaravelMediaSecure"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions config/laravel-media-secure.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use Bekwoh\LaravelMediaSecure\Http\Controllers\MediaController;
use CleaniqueCoders\LaravelMediaSecure\Http\Controllers\MediaController;

return [
/**
Expand All @@ -11,7 +11,7 @@
/**
* Spatie's Model Media Policy
*/
'policy' => \Bekwoh\LaravelMediaSecure\Policies\MediaPolicy::class,
'policy' => \CleaniqueCoders\LaravelMediaSecure\Policies\MediaPolicy::class,

/**
* Controller to manage access to the media.
Expand Down
5 changes: 1 addition & 4 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ parameters:
level: 4
ignoreErrors:
-
message: '#Access to an undefined property Spatie\\MediaLibrary\\MediaCollections\\Models\\Media::\$uuid.#'
path: support/helpers.php
-
message: '#Method Bekwoh\\LaravelMediaSecure\\Http\\Controllers\\MediaController::__invoke\(\) should return Illuminate\\Http\\Response but returns Symfony\\Component\\HttpFoundation\\BinaryFileResponse.#'
message: '#Method CleaniqueCoders\\LaravelMediaSecure\\Http\\Controllers\\MediaController::__invoke\(\) should return Illuminate\\Http\\Response but returns Symfony\\Component\\HttpFoundation\\BinaryFileResponse.#'
path: src/Http/Controllers/MediaController.php
paths:
- config
Expand Down
58 changes: 21 additions & 37 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
>
<testsuites>
<testsuite name="Bekwoh Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true" beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="CleaniqueCoders Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/Enums/MediaAccess.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bekwoh\LaravelMediaSecure\Enums;
namespace CleaniqueCoders\LaravelMediaSecure\Enums;

use Spatie\Enum\Laravel\Enum;

Expand Down
6 changes: 3 additions & 3 deletions src/Facades/LaravelMediaSecure.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php

namespace Bekwoh\LaravelMediaSecure\Facades;
namespace CleaniqueCoders\LaravelMediaSecure\Facades;

use Illuminate\Support\Facades\Facade;

/**
* @see \Bekwoh\LaravelMediaSecure\LaravelMediaSecure
* @see \CleaniqueCoders\LaravelMediaSecure\LaravelMediaSecure
*/
class LaravelMediaSecure extends Facade
{
protected static function getFacadeAccessor()
{
return \Bekwoh\LaravelMediaSecure\LaravelMediaSecure::class;
return \CleaniqueCoders\LaravelMediaSecure\LaravelMediaSecure::class;
}
}
2 changes: 1 addition & 1 deletion src/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bekwoh\LaravelMediaSecure\Http\Controllers;
namespace CleaniqueCoders\LaravelMediaSecure\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
Expand Down
7 changes: 2 additions & 5 deletions src/Http/Controllers/MediaController.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
<?php

namespace Bekwoh\LaravelMediaSecure\Http\Controllers;
namespace CleaniqueCoders\LaravelMediaSecure\Http\Controllers;

use Bekwoh\LaravelMediaSecure\Enums\MediaAccess;
use CleaniqueCoders\LaravelMediaSecure\Enums\MediaAccess;
use Illuminate\Http\Request;

class MediaController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param string $type
* @param string $uuid
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, string $type, string $uuid)
Expand Down
14 changes: 7 additions & 7 deletions src/LaravelMediaSecure.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bekwoh\LaravelMediaSecure;
namespace CleaniqueCoders\LaravelMediaSecure;

use Illuminate\Support\Facades\Route;

Expand All @@ -12,11 +12,11 @@ public static function routes()
config('laravel-media-secure.prefix').'/{type}/{uuid}',
config('laravel-media-secure.controller')
)
->name(
config('laravel-media-secure.route_name')
)
->middleware(
config('laravel-media-secure.middleware', ['auth', 'verified'])
);
->name(
config('laravel-media-secure.route_name')
)
->middleware(
config('laravel-media-secure.middleware', ['auth', 'verified'])
);
}
}
2 changes: 1 addition & 1 deletion src/LaravelMediaSecureServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bekwoh\LaravelMediaSecure;
namespace CleaniqueCoders\LaravelMediaSecure;

use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
Expand Down
6 changes: 1 addition & 5 deletions src/Policies/MediaPolicy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bekwoh\LaravelMediaSecure\Policies;
namespace CleaniqueCoders\LaravelMediaSecure\Policies;

use Illuminate\Auth\Access\HandlesAuthorization;
use Illuminate\Foundation\Auth\User;
Expand All @@ -14,8 +14,6 @@ class MediaPolicy
/**
* Determine whether the user can view the model.
*
* @param \Illuminate\Foundation\Auth\User $user
* @param \Spatie\MediaLibrary\MediaCollections\Models\Media $media
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, Media $media)
Expand All @@ -38,8 +36,6 @@ public function view(User $user, Media $media)
/**
* Determine whether the user can view the model.
*
* @param \Illuminate\Foundation\Auth\User $user
* @param \Spatie\MediaLibrary\MediaCollections\Models\Media $media
* @return \Illuminate\Auth\Access\Response|bool
*/
public function download(User $user, Media $media)
Expand Down
2 changes: 1 addition & 1 deletion support/helpers.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use Bekwoh\LaravelMediaSecure\Enums\MediaAccess;
use CleaniqueCoders\LaravelMediaSecure\Enums\MediaAccess;
use Spatie\MediaLibrary\MediaCollections\Models\Media;

if (! function_exists('get_media_url')) {
Expand Down
5 changes: 3 additions & 2 deletions tests/LaravelMediaSecureTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php

use Bekwoh\LaravelMediaSecure\Enums\MediaAccess;
use Bekwoh\LaravelMediaSecure\LaravelMediaSecure;
use CleaniqueCoders\LaravelMediaSecure\Enums\MediaAccess;
use CleaniqueCoders\LaravelMediaSecure\LaravelMediaSecure;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Schema;

use function Pest\Laravel\get;
use function PHPUnit\Framework\assertTrue;

Expand Down
2 changes: 1 addition & 1 deletion tests/Models/User.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bekwoh\LaravelMediaSecure\Tests\Models;
namespace CleaniqueCoders\LaravelMediaSecure\Tests\Models;

use Illuminate\Foundation\Auth\User as Model;
use Spatie\MediaLibrary\HasMedia;
Expand Down
4 changes: 2 additions & 2 deletions tests/Pest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use Bekwoh\LaravelMediaSecure\Tests\Models\User;
use Bekwoh\LaravelMediaSecure\Tests\TestCase;
use CleaniqueCoders\LaravelMediaSecure\Tests\Models\User;
use CleaniqueCoders\LaravelMediaSecure\Tests\TestCase;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;

Expand Down
Loading

0 comments on commit 97e7105

Please sign in to comment.