Skip to content

Commit

Permalink
Merge pull request #22 from vickzkater/v2.0.7
Browse files Browse the repository at this point in the history
v2.0.7
  • Loading branch information
vickzkater authored Mar 8, 2021
2 parents f7197b7 + 92e70d8 commit d70fa79
Show file tree
Hide file tree
Showing 13 changed files with 1,356 additions and 466 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ API_PASS=
APP_TIMEZONE="UTC"
APP_MAINTENANCE_UNTIL="2021, 1 - 1, 12" #format (Y, m - 1, d)

MULTILANG_MODULE=true
DEFAULT_LANGUAGE=EN

META_DESCRIPTION="Lara-S-CMS is a PHP Laravel Skeleton for Content Management System/Admin Dashboard (within/without website)"
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
=========

## Version 2.0.7
- Update the packages (Laravel Framework 7.30.3 > 7.30.4)
- Optimize multi languages
- Add [Laravel Debugbar](https://github.com/barryvdh/laravel-debugbar)
- Remove package fzaninotto/faker (security issue)
- Update package phpunit to version 9 (warning issue)
- Fix issue for 404 error page when using the admin dashboard only

## Version 2.0.6
- Update config global mail for setup reply-to
- Update session redirect uri for web (separate from admin) using session "redirect_uri_web"
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<a href="https://packagist.org/packages/vickzkater/lara-s-cms" target="_blank"><img class="license_img" src="https://img.shields.io/packagist/l/vickzkater/lara-s-cms" alt="License"></a>
</p>

***Latest Version: 2.0.6 (Laravel 7.30.3)**
***Latest Version: 2.0.7 (Laravel 7.30.4)**

## What is "Lara-S-CMS" ?

Expand Down Expand Up @@ -93,7 +93,7 @@ Developed by [@vickzkater](https://github.com/vickzkater/) (Powered by [KINIDI T

## Requirements

- PHP >= 7.2
- PHP >= 7.3
- [Laravel 7.x Requirements](https://laravel.com/docs/7.x/installation#server-requirements)

## Installing Lara-S-CMS
Expand Down Expand Up @@ -139,6 +139,7 @@ Next, setup environment configuration in `.env` file
- Set `APP_TIMEZONE` for set timezone application, sample: UTC (GMT) or Asia/Jakarta (GMT+7) or Asia/Kuala_Lumpur (GMT+8)
- Set `APP_MAINTENANCE_UNTIL` for set deadline maintenance application using format (Y, m - 1, d)

- Set `MULTILANG_MODULE` for enable/disable multi languages module in application
- Set `DEFAULT_LANGUAGE` for set default language in application

- Set `META_DESCRIPTION` for set meta description
Expand Down Expand Up @@ -252,11 +253,15 @@ Comment first line in `.htaccess` for fix this issue

_*) This issue is reported only occur on some hosting servers, e.g. AWS (Amazon Web Service)_

**Somethings that maybe you must know**
***For your information**

- `CustomFunction.php` in `app\Libraries\` that automatically called in the load of web because it has been set in `composer.json`
- `Helper.php` in `app\Libraries\` that can be called in Controller/View by line code `use App\Libraries\Helper;` for call some helper functions

## IMPORTANT NOTE!

Please set `APP_DEBUG` to `false` on Production to disable [Laravel Debugbar](https://github.com/barryvdh/laravel-debugbar).

## Session Driver Database

When using the `database` session driver, you will need to create a table to contain the session items. Below is an example `Schema` declaration for the table:
Expand Down Expand Up @@ -334,6 +339,7 @@ The default template for maintenance mode responses is located in `resources/vie
- [simplesoftwareio/simple-qrcode](https://github.com/SimpleSoftwareIO/simple-qrcode) - used to generate QR code
- [laravel/socialite](https://github.com/laravel/socialite) - used to login with social media
- [intervention/image](https://github.com/Intervention/image) - used to generate thumbnail image
- [Laravel Debugbar](https://github.com/barryvdh/laravel-debugbar) - used to development

## Libraries Used

Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function __construct()

// get language data
$translation = [];
if (env('APP_BACKEND', 'MODEL') != 'API') {
if (env('APP_BACKEND', 'MODEL') != 'API' && env('MULTILANG_MODULE', false)) {
$getLanguageMasterMenu = DB::table('sys_language_master_details')
->select('sys_language_master.phrase', 'sys_language_master_details.translate')
->leftJoin('sys_languages', 'sys_language_master_details.language_id', '=', 'sys_languages.id')
Expand All @@ -89,7 +89,7 @@ public function __construct()

// set available languages
$languages = [];
if (env('APP_BACKEND', 'MODEL') != 'API') {
if (env('APP_BACKEND', 'MODEL') != 'API' && env('MULTILANG_MODULE', false)) {
$getLanguages = DB::table('sys_languages')->where('status', 1)->get();

// convert to single array
Expand Down
25 changes: 13 additions & 12 deletions app/Libraries/CustomFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@
*/
function lang($phrase, $translation = [], $replace_words = [])
{
// if not found the translation, search from database
if (!is_array($translation) || count($translation) < 1) {
// get default language
$default_lang = env('DEFAULT_LANGUAGE', 'EN');

// set language
$language = Session::get('language');
if (empty($language)) {
$language = $default_lang;
}
// get default language
$default_lang = env('DEFAULT_LANGUAGE', 'EN');

// set language
$language = Session::get('language');
if (empty($language)) {
$language = $default_lang;
}

// if not found the translation, search from database
if ((!is_array($translation) || count($translation) < 1) && $language != $default_lang) {
// get language data
if (env('APP_BACKEND', 'MODEL') != 'API') {
$translation = DB::table('sys_language_master_details')->select('sys_language_master.phrase', 'sys_language_master_details.translate')
if (env('APP_BACKEND', 'MODEL') != 'API' && env('MULTILANG_MODULE', false)) {
$translation = DB::table('sys_language_master_details')
->select('sys_language_master.phrase', 'sys_language_master_details.translate')
->leftJoin('sys_languages', 'sys_languages.id', 'sys_language_master_details.language_id')
->leftJoin('sys_language_master', 'sys_language_master.id', 'sys_language_master_details.language_master_id')
->where('sys_languages.alias', $language)
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
"yajra/laravel-datatables-oracle": "~9.0"
},
"require-dev": {
"facade/ignition": "^2.0",
"barryvdh/laravel-debugbar": "^3.5",
"beyondcode/laravel-dump-server": "^1.0",
"facade/ignition": "^2.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
"phpunit/phpunit": "^9"
},
"config": {
"optimize-autoloader": true,
Expand Down
Loading

0 comments on commit d70fa79

Please sign in to comment.