Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-adminpanel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
laravel-adminpanel
Commits
7718cc31
Unverified
Commit
7718cc31
authored
Jan 01, 2018
by
Viral Solani
Committed by
GitHub
Jan 01, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #121 from viralsolani/analysis-zOmeyL
Apply fixes from StyleCI
parents
7097767f
51d133e4
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
50 additions
and
58 deletions
+50
-58
PagesTableController.php
app/Http/Controllers/Backend/Pages/PagesTableController.php
+0
-1
SettingsController.php
app/Http/Controllers/Backend/Settings/SettingsController.php
+1
-2
SettingsLogoController.php
...p/Controllers/Backend/Settings/SettingsLogoController.php
+4
-4
Page.php
app/Models/Page/Page.php
+3
-3
PageRelationship.php
app/Models/Page/Traits/PageRelationship.php
+1
-2
BlogsRepository.php
app/Repositories/Backend/Blogs/BlogsRepository.php
+1
-1
PagesRepository.php
app/Repositories/Backend/Pages/PagesRepository.php
+1
-1
SettingsRepository.php
app/Repositories/Backend/Settings/SettingsRepository.php
+22
-19
BlogCategoryFactory.php
database/factories/BlogCategoryFactory.php
+3
-3
ManageSettingsTest.php
tests/Feature/Backend/ManageSettingsTest.php
+7
-9
ManageBlogCategoriesTest.php
tests/Feature/ManageBlogCategoriesTest.php
+4
-6
BlogCategoryTest.php
tests/Unit/BlogCategoryTest.php
+0
-2
PageTest.php
tests/Unit/PageTest.php
+3
-5
No files found.
app/Http/Controllers/Backend/Pages/PagesTableController.php
View file @
7718cc31
...
...
@@ -5,7 +5,6 @@ namespace App\Http\Controllers\Backend\Pages;
use
App\Http\Controllers\Controller
;
use
App\Http\Requests\Backend\Pages\ManagePageRequest
;
use
App\Repositories\Backend\Pages\PagesRepository
;
use
Carbon\Carbon
;
use
Yajra\DataTables\Facades\DataTables
;
/**
...
...
app/Http/Controllers/Backend/Settings/SettingsController.php
View file @
7718cc31
...
...
@@ -7,7 +7,6 @@ use App\Http\Requests\Backend\Settings\ManageSettingsRequest;
use
App\Http\Requests\Backend\Settings\UpdateSettingsRequest
;
use
App\Models\Settings\Setting
;
use
App\Repositories\Backend\Settings\SettingsRepository
;
use
Illuminate\Http\Request
;
/**
* Class SettingsController.
...
...
app/Http/Controllers/Backend/Settings/SettingsLogoController.php
View file @
7718cc31
...
...
@@ -23,7 +23,7 @@ class SettingsLogoController extends Controller
}
/**
* Remove logo or favicon icon
* Remove logo or favicon icon
.
*
* @param \App\Models\Settings\Setting $setting
* @param \Illuminate\Http\Request $request
...
...
@@ -35,7 +35,7 @@ class SettingsLogoController extends Controller
$this
->
settings
->
removeLogo
(
$setting
,
$request
->
data
);
return
json_encode
([
'status'
=>
true
'status'
=>
true
,
]);
}
}
app/Models/Page/Page.php
View file @
7718cc31
...
...
@@ -4,9 +4,9 @@ namespace App\Models\Page;
use
App\Models\BaseModel
;
use
App\Models\ModelTrait
;
use
App\Models\Page\Traits\Attribute\PageAttribute
;
use
App\Models\Page\Traits\PageRelationship
;
use
Illuminate\Database\Eloquent\SoftDeletes
;
use
App\Models\Page\Traits\Attribute\PageAttribute
;
class
Page
extends
BaseModel
{
...
...
@@ -32,12 +32,12 @@ class Page extends BaseModel
protected
$guarded
=
[
'id'
];
/**
* The default values for attributes
* The default values for attributes
.
*
* @var array
*/
protected
$attributes
=
[
'created_by'
=>
1
'created_by'
=>
1
,
];
protected
$with
=
[
'owner'
];
...
...
app/Models/Page/Traits/PageRelationship.php
View file @
7718cc31
...
...
@@ -4,7 +4,6 @@ namespace App\Models\Page\Traits;
use
App\Models\Access\User\User
;
trait
PageRelationship
{
public
function
owner
()
...
...
app/Repositories/Backend/Blogs/BlogsRepository.php
View file @
7718cc31
...
...
@@ -132,7 +132,7 @@ class BlogsRepository extends BaseRepository
/**
* Creating Tags.
*
* @param
A
rray $tags
* @param
a
rray $tags
*
* @return array
*/
...
...
app/Repositories/Backend/Pages/PagesRepository.php
View file @
7718cc31
...
...
@@ -32,7 +32,7 @@ class PagesRepository extends BaseRepository
config
(
'module.pages.table'
)
.
'.status'
,
config
(
'module.pages.table'
)
.
'.created_at'
,
config
(
'module.pages.table'
)
.
'.updated_at'
,
config
(
'access.users_table'
)
.
'.first_name as created_by'
config
(
'access.users_table'
)
.
'.first_name as created_by'
,
]);
}
...
...
app/Repositories/Backend/Settings/SettingsRepository.php
View file @
7718cc31
...
...
@@ -2,8 +2,8 @@
namespace
App\Repositories\Backend\Settings
;
use
App\Models\Settings\Setting
;
use
App\Exceptions\GeneralException
;
use
App\Models\Settings\Setting
;
use
App\Repositories\BaseRepository
;
use
Illuminate\Support\Facades\Storage
;
...
...
@@ -18,39 +18,39 @@ class SettingsRepository extends BaseRepository
const
MODEL
=
Setting
::
class
;
/**
* Site Logo Path
* Site Logo Path
.
*
* @var string
*/
protected
$site_logo_path
;
/**
* Favicon path
* Favicon path
.
*
* @var string
*/
protected
$favicon_path
;
/**
* Storage Class Object
* Storage Class Object
.
*
* @var \Illuminate\Support\Facades\Storage
*/
protected
$storage
;
/**
* Constructor
* Constructor
.
*/
public
function
__construct
()
{
$this
->
site_logo_path
=
'img'
.
DIRECTORY_SEPARATOR
.
'logo'
.
DIRECTORY_SEPARATOR
;
$this
->
favicon_path
=
'img'
.
DIRECTORY_SEPARATOR
.
'favicon'
.
DIRECTORY_SEPARATOR
;
$this
->
site_logo_path
=
'img'
.
DIRECTORY_SEPARATOR
.
'logo'
.
DIRECTORY_SEPARATOR
;
$this
->
favicon_path
=
'img'
.
DIRECTORY_SEPARATOR
.
'favicon'
.
DIRECTORY_SEPARATOR
;
$this
->
storage
=
Storage
::
disk
(
'public'
);
}
/**
* @param \App\Models\Settings\Setting $setting
* @param
Array
$input
* @param
array
$input
*
* @throws \App\Exceptions\GeneralException
*
...
...
@@ -58,20 +58,21 @@ class SettingsRepository extends BaseRepository
*/
public
function
update
(
Setting
$setting
,
array
$input
)
{
if
(
!
empty
(
$input
[
'logo'
]))
{
if
(
!
empty
(
$input
[
'logo'
]))
{
$this
->
removeLogo
(
$setting
,
'logo'
);
$input
[
'logo'
]
=
$this
->
uploadLogo
(
$setting
,
$input
[
'logo'
],
'logo'
);
}
if
(
!
empty
(
$input
[
'favicon'
]))
{
if
(
!
empty
(
$input
[
'favicon'
]))
{
$this
->
removeLogo
(
$setting
,
'favicon'
);
$input
[
'favicon'
]
=
$this
->
uploadLogo
(
$setting
,
$input
[
'favicon'
],
'favicon'
);
}
if
(
$setting
->
update
(
$input
))
if
(
$setting
->
update
(
$input
))
{
return
true
;
}
throw
new
GeneralException
(
trans
(
'exceptions.backend.settings.update_error'
));
}
...
...
@@ -81,11 +82,11 @@ class SettingsRepository extends BaseRepository
*/
public
function
uploadLogo
(
$setting
,
$logo
,
$type
)
{
$path
=
$type
==
"logo"
?
$this
->
site_logo_path
:
$this
->
favicon_path
;
$path
=
$type
==
'logo'
?
$this
->
site_logo_path
:
$this
->
favicon_path
;
$image_name
=
time
()
.
$logo
->
getClientOriginalName
();
$image_name
=
time
()
.
$logo
->
getClientOriginalName
();
$this
->
storage
->
put
(
$path
.
$image_name
,
file_get_contents
(
$logo
->
getRealPath
()));
$this
->
storage
->
put
(
$path
.
$image_name
,
file_get_contents
(
$logo
->
getRealPath
()));
return
$image_name
;
}
...
...
@@ -95,15 +96,17 @@ class SettingsRepository extends BaseRepository
*/
public
function
removeLogo
(
Setting
$setting
,
$type
)
{
$path
=
$type
==
"logo"
?
$this
->
site_logo_path
:
$this
->
favicon_path
;
$path
=
$type
==
'logo'
?
$this
->
site_logo_path
:
$this
->
favicon_path
;
if
(
$setting
->
$type
&&
$this
->
storage
->
exists
(
$path
.
$setting
->
$type
))
{
$this
->
storage
->
delete
(
$path
.
$setting
->
$type
);
if
(
$setting
->
$type
&&
$this
->
storage
->
exists
(
$path
.
$setting
->
$type
))
{
$this
->
storage
->
delete
(
$path
.
$setting
->
$type
);
}
$result
=
$setting
->
update
([
$type
=>
null
]);
$result
=
$setting
->
update
([
$type
=>
null
]);
if
(
$result
)
return
true
;
if
(
$result
)
{
return
true
;
}
throw
new
GeneralException
(
trans
(
'exceptions.backend.settings.update_error'
));
}
...
...
database/factories/BlogCategoryFactory.php
View file @
7718cc31
<?php
use
Faker\Generator
as
Faker
;
use
App\Models\Access\User\User
;
use
App\Models\BlogCategories\BlogCategory
;
use
Faker\Generator
as
Faker
;
$factory
->
define
(
BlogCategory
::
class
,
function
(
Faker
$faker
)
{
return
[
...
...
tests/Feature/Backend/ManageSettingsTest.php
View file @
7718cc31
...
...
@@ -2,12 +2,10 @@
namespace
Tests\Feature\Backend
;
use
Tests\TestCase
;
use
App\Models\Settings\Setting
;
use
Illuminate\Http\UploadedFile
;
use
Illuminate\Support\Facades\Storage
;
use
Illuminate\Foundation\Testing\WithFaker
;
use
Illuminate\Foundation\Testing\RefreshDatabase
;
use
Tests\TestCase
;
class
ManageSettingsTest
extends
TestCase
{
...
...
@@ -37,10 +35,10 @@ class ManageSettingsTest extends TestCase
public
function
it_can_update_a_valid_site_logo
()
{
$this
->
patch
(
route
(
'admin.settings.update'
,
$this
->
setting
),
[
'logo'
=>
UploadedFile
::
fake
()
->
image
(
'logo.jpg'
,
226
,
48
)
'logo'
=>
UploadedFile
::
fake
()
->
image
(
'logo.jpg'
,
226
,
48
)
,
]);
Storage
::
disk
(
'public'
)
->
assertExists
(
'img/logo/'
.
$this
->
setting
->
logo
);
Storage
::
disk
(
'public'
)
->
assertExists
(
'img/logo/'
.
$this
->
setting
->
logo
);
}
/** @test */
...
...
@@ -49,7 +47,7 @@ class ManageSettingsTest extends TestCase
$this
->
withExceptionHandling
();
$this
->
patch
(
route
(
'admin.settings.update'
,
$this
->
setting
),
[
'logo'
=>
UploadedFile
::
fake
()
->
image
(
'logo.jpg'
,
200
,
500
)
'logo'
=>
UploadedFile
::
fake
()
->
image
(
'logo.jpg'
,
200
,
500
)
,
])
->
assertSessionHasErrors
(
'logo'
);
}
...
...
@@ -58,10 +56,10 @@ class ManageSettingsTest extends TestCase
public
function
it_can_update_site_favicon
()
{
$this
->
patch
(
route
(
'admin.settings.update'
,
$this
->
setting
),
[
'favicon'
=>
UploadedFile
::
fake
()
->
image
(
'favicon.jpg'
,
16
,
16
)
'favicon'
=>
UploadedFile
::
fake
()
->
image
(
'favicon.jpg'
,
16
,
16
)
,
]);
Storage
::
disk
(
'public'
)
->
assertExists
(
'img/favicon/'
.
$this
->
setting
->
favicon
);
Storage
::
disk
(
'public'
)
->
assertExists
(
'img/favicon/'
.
$this
->
setting
->
favicon
);
}
/** @test */
...
...
@@ -70,7 +68,7 @@ class ManageSettingsTest extends TestCase
$this
->
withExceptionHandling
();
$this
->
patch
(
route
(
'admin.settings.update'
,
$this
->
setting
),
[
'favicon'
=>
UploadedFile
::
fake
()
->
image
(
'favicon.jpg'
,
200
,
500
)
'favicon'
=>
UploadedFile
::
fake
()
->
image
(
'favicon.jpg'
,
200
,
500
)
,
])
->
assertSessionHasErrors
(
'favicon'
);
}
...
...
tests/Feature/ManageBlogCategoriesTest.php
View file @
7718cc31
...
...
@@ -2,10 +2,8 @@
namespace
Tests\Feature
;
use
Tests\TestCase
;
use
App\Models\BlogCategories\BlogCategory
;
use
Illuminate\Foundation\Testing\WithFaker
;
use
Illuminate\Foundation\Testing\RefreshDatabase
;
use
Tests\TestCase
;
class
ManageBlogCategoriesTest
extends
TestCase
{
...
...
tests/Unit/BlogCategoryTest.php
View file @
7718cc31
...
...
@@ -3,8 +3,6 @@
namespace
Tests\Unit
;
use
Tests\TestCase
;
use
Illuminate\Foundation\Testing\WithFaker
;
use
Illuminate\Foundation\Testing\RefreshDatabase
;
class
BlogCategoryTest
extends
TestCase
{
...
...
tests/Unit/PageTest.php
View file @
7718cc31
...
...
@@ -2,11 +2,9 @@
namespace
Tests\Unit
;
use
Tests\TestCase
;
use
App\Models\Page\Page
;
use
App\Models\Access\User\User
;
use
Illuminate\Foundation\Testing\WithFaker
;
use
Illuminate\Foundation\Testing\RefreshDatab
ase
;
use
App\Models\Page\Page
;
use
Tests\TestC
ase
;
class
PageTest
extends
TestCase
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment