Skip to content

Commit

Permalink
Merge pull request #10 from vickzkater/v2.0.0
Browse files Browse the repository at this point in the history
V2.0.0
  • Loading branch information
vickzkater authored Jul 6, 2020
2 parents 190507b + 5a46ec8 commit 6c5c3c0
Show file tree
Hide file tree
Showing 31 changed files with 1,529 additions and 927 deletions.
39 changes: 28 additions & 11 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,34 @@ APP_NAME="Lara-S-CMS"
APP_ENV=local
APP_KEY=
APP_URL=http://localhost

APP_DEBUG=true
DISPLAY_SESSION=false

APP_VERSION="1.0"
APP_BACKEND=MODEL
ADMIN_CMS=true
ADMIN_DIR="manager"

APP_URL_SITE=http://localhost/lara-s-cms/public/${ADMIN_DIR}
APP_URL_API=http://localhost/lara-s-cms/public/api

APP_TIMEZONE="UTC"
APP_MAINTENANCE_UNTIL="2021, 1 - 1, 12" #format (Y, m - 1, d)

ADMIN_DIR="manager"

DEFAULT_LANGUAGE=EN

META_DESCRIPTION="Lara-S-CMS is a PHP Laravel Skeleton for Content Management System/Admin Dashboard (within/without website)"
META_AUTHOR="KINIDI Tech"

APP_FAVICON_TYPE=ico
APP_FAVICON="favicon.ico"

APP_LOGO=laptop
APP_LOGO_IMAGE="images/logo-square.png"

POWERED="KINIDI Tech"
POWERED_URL="https://kiniditech.com"

LOG_CHANNEL=stack

DB_CONNECTION=mysql
Expand Down Expand Up @@ -67,25 +84,25 @@ RECAPTCHA_SECRET_KEY=
RECAPTCHA_SITE_KEY_ADMIN=
RECAPTCHA_SECRET_KEY_ADMIN=

GOOGLE_CLIENT_MODULE=ON
GOOGLE_CLIENT_MODULE=true
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_CALLBACK_URL="${APP_URL}/auth/google/callback"
GOOGLE_CALLBACK_URL="${APP_URL_SITE}/auth/google/callback"

FACEBOOK_CLIENT_MODULE=ON
FACEBOOK_CLIENT_MODULE=true
FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=
FACEBOOK_CALLBACK_URL="${APP_URL}/auth/facebook/callback"
FACEBOOK_CALLBACK_URL="${APP_URL_SITE}/auth/facebook/callback"

TWITTER_CLIENT_MODULE=OFF
TWITTER_CLIENT_MODULE=false
TWITTER_CLIENT_ID=
TWITTER_CLIENT_SECRET=
TWITTER_CALLBACK_URL="${APP_URL}/auth/twitter/callback"
TWITTER_CALLBACK_URL="${APP_URL_SITE}/auth/twitter/callback"

LINKEDIN_CLIENT_MODULE=OFF
LINKEDIN_CLIENT_MODULE=false
LINKEDIN_CLIENT_ID=
LINKEDIN_CLIENT_SECRET=
LINKEDIN_CALLBACK_URL="${APP_URL}/auth/linkedin/callback"
LINKEDIN_CALLBACK_URL="${APP_URL_SITE}/auth/linkedin/callback"

FCM_SERVER_KEY=
FCM_SENDER_ID=
Expand Down
9 changes: 8 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@ Header always set Content-Security-Policy: upgrade-insecure-requests
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
</IfModule>

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ Developed by [@vickzkater](https://github.com/vickzkater/) (Powered by [KINIDI T
- [x] [Support Mailchimp API (in DevController)](https://github.com/vickzkater/mailchimp-helper-laravel)
- [x] [PageBuilder](https://github.com/vickzkater/kiniditech-pagebuilder) (in Article)
- [x] [The Helper JS - a lot of JS helper functions that are ready to help in your project](https://github.com/vickzkater/the-helper-js)
- [x] Banner Management- [x] Application Configurations
- [x] Banner Management
- [x] QR Code Generator
- [x] Login with social media (Google/Facebook)
- [x] Support back-end mode (MODEL or API)
- [x] Support upload file (PDF/TXT/DOCS/etc)

## Admin Panel

Expand Down Expand Up @@ -105,13 +109,34 @@ The next thing you should do after installing Lara-S-CMS is set your application

Next, setup environment configuration in `.env` file

- Set `APP_NAME` for application name
- Set `DISPLAY_SESSION` for enable/disable display session in Admin - Footer (Development Purpose)

- Set `APP_VERSION` for set application version
- Set `APP_BACKEND` for choose application back-end mode (MODEL or API) if use API, please make sure `APP_URL_API` is not empty
- Set `ADMIN_CMS` for enable/disable Admin Panel
- Set `ADMIN_DIR` for set application or admin system directory name (or leave it blank if using the admin dashboard only)

- Set `APP_URL_SITE` for set application URL that used for login with social media
- Set `APP_URL_API` for set API URL, if this project using back-end mode API (`APP_BACKEND`=API)

- Set `APP_TIMEZONE` for set timezone application, sample: UTC or Asia/Jakarta
- Set `APP_MAINTENANCE_UNTIL` for set deadline maintenance application using format (Y, m - 1, d)
- Set `ADMIN_DIR` for set application or admin system directory name (or leave it blank if using the admin dashboard only)

- Set `DEFAULT_LANGUAGE` for set default language in application

- Set `META_DESCRIPTION` for set meta description
- Set `META_AUTHOR` for set meta author

- Set `APP_FAVICON_TYPE` for set favicon type (ico/png/etc)
- Set `APP_FAVICON` for set application favicon based on file image (input with image's path), sample: the favicon file is in public/images directory path, then set 'images/favicon.ico'

- Set `APP_LOGO` for set application logo based on Font Awesome (input without 'fa-' just the icon name, example: star/laptop/bank)
- Set `APP_LOGO_IMAGE` for set application logo based on file image (input with image's path), sample: the logo image is in "public/images" directory path, then set "images/logo.png"

- Set `POWERED` for display developer name
- Set `POWERED_URL` for display developer URL

- Set `MAIL_FROM_NAME` for set sender email's name
- Set `MAIL_FROM_ADDRESS` for set sender email's address
- Set `MAIL_REPLYTO_NAME` for set reply-to email's name
Expand Down Expand Up @@ -229,6 +254,8 @@ The default template for maintenance mode responses is located in `resources/vie
- [maatwebsite/excel](https://github.com/Maatwebsite/Laravel-Excel) - used to export & import Excel data
- [guzzlehttp/guzzle](https://github.com/guzzle/guzzle) - used to send HTTP requests and trivial to integrate with web services
- [nztim/mailchimp](https://github.com/nztim/mailchimp) - used to Mailchimp API
- [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

## Libraries Used

Expand Down
7 changes: 7 additions & 0 deletions VERSION.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## Version 2.0.0
### Changelog
- Add QR Code Generator
- Add support login with social media (Google/Facebook)
- Add support back-end mode (MODEL or API)
- Add support upload file (PDF/TXT/DOCS/etc)

## Version 1.2.3
### Changelog
- Add PageBuilder
Expand Down
176 changes: 176 additions & 0 deletions app/Http/Controllers/API/ApiController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<?php

namespace App\Http\Controllers\API;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

// LIBRARIES
use App\Libraries\Helper;

// MODELS
use App\Models\Product;
use App\Models\Article;
use App\Models\Topic;
use App\Models\Banner;

class ApiController extends Controller
{
public function index()
{
return '[API] Lara-S-CMS';
}

public function get_banner()
{
$data = Banner::where('status', 1)->orderBy('ordinal')->get();

return response()->json([
'status' => 'true',
'message' => 'Successfully get banner data',
'data' => $data
]);
}

public function get_product()
{
$data = Product::whereNull('replaced_at')
->orderBy('id', 'desc')
->get();

return response()->json([
'status' => 'true',
'message' => 'Successfully get product data',
'data' => $data
]);
}

public function get_topic()
{
$data = Topic::where('status', 1)
->orderBy('name')
->get();

return response()->json([
'status' => 'true',
'message' => 'Successfully get topic data',
'data' => $data
]);
}

public function get_blog(Request $request)
{
// GET THE DATA
$data = Article::select(
'articles.slug',
'articles.title',
'articles.thumbnail',
'articles.summary',
'articles.posted_at',
'articles.author'
)
->leftJoin('article_topic', 'articles.id', '=', 'article_topic.article_id')
->leftJoin('topics', 'article_topic.topic_id', '=', 'topics.id')
->where('articles.status', 1)
->orderBy('articles.posted_at', 'desc')
->groupBy(
'articles.slug',
'articles.title',
'articles.thumbnail',
'articles.summary',
'articles.posted_at',
'articles.author'
);

// FILTER BY TOPIC
if ($request->topic) {
$topic = Helper::validate_input_text($request->topic);
$data->where('topics.name', $topic);
}

// FILTER BY KEYWORD
if ($request->keyword) {
$keyword = Helper::validate_input_text($request->keyword);
$data->where(function ($query_where) use ($keyword) {
$query_where->where('articles.title', 'LIKE', '%' . $keyword . '%')
->orWhere('articles.keywords', 'LIKE', '%' . $keyword . '%')
->orWhere('articles.summary', 'LIKE', '%' . $keyword . '%')
->orWhere('articles.content', 'LIKE', '%' . $keyword . '%')
->orWhere('topics.name', 'LIKE', '%' . $keyword . '%');
});
}

// FILTER BY AUTHOR
if ($request->author) {
$author = Helper::validate_input_text($request->author);
$data->where('articles.author', $author);
}

// GET TOTAL DATA
$query = $data;
$total = $query->get()->count();

// PAGINATION
$limit = 3;
$page = 1;
if ((int) $request->page) {
$page = (int) $request->page;
}
if ($page < 1) {
$page = 1;
}
$skip = ($page - 1) * $limit;

$data = $data
->take($limit)
->skip($skip)
->get();

return response()->json([
'status' => 'true',
'message' => 'Successfully get blog data',
'data' => $data,
'total' => $total
]);
}

public function get_blog_details(Request $request)
{
// GET PARAMATERS DATA
$slug = $request->slug;

// GET THE DATA
$data = Article::select(
'articles.slug',
'articles.title',
'articles.thumbnail',
'articles.posted_at',
'articles.author',
'articles.summary',
'articles.content',
DB::raw('GROUP_CONCAT(topics.name SEPARATOR " | ") AS topics')
)
->leftJoin('article_topic', 'articles.id', '=', 'article_topic.article_id')
->leftJoin('topics', 'article_topic.topic_id', '=', 'topics.id')
->where('articles.status', 1)
->where('articles.slug', $slug)
->orderBy('articles.posted_at', 'desc')
->groupBy(
'articles.slug',
'articles.title',
'articles.thumbnail',
'articles.posted_at',
'articles.author',
'articles.summary',
'articles.content'
)
->first();

return response()->json([
'status' => 'true',
'message' => 'Successfully get blog details data',
'data' => $data
]);
}
}
Loading

0 comments on commit 6c5c3c0

Please sign in to comment.