Skip to content

Commit 7dfb52e

Browse files
upgraded to laravel 6.x
0 parents  commit 7dfb52e

File tree

264 files changed

+78235
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+78235
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

.env.example

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
APP_NAME="Origin CMS"
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
BRAND_NAME="Origin CMS"
7+
BRAND_ABBR=OC
8+
9+
LOG_CHANNEL=stack
10+
11+
DB_CONNECTION=mysql
12+
DB_HOST=127.0.0.1
13+
DB_PORT=3306
14+
DB_DATABASE=laravel
15+
DB_USERNAME=root
16+
DB_PASSWORD=
17+
18+
BROADCAST_DRIVER=log
19+
CACHE_DRIVER=file
20+
QUEUE_CONNECTION=sync
21+
SESSION_DRIVER=file
22+
SESSION_LIFETIME=120
23+
24+
REDIS_HOST=127.0.0.1
25+
REDIS_PASSWORD=null
26+
REDIS_PORT=6379
27+
28+
MAIL_DRIVER=smtp
29+
MAIL_HOST=smtp.mailtrap.io
30+
MAIL_PORT=2525
31+
MAIL_USERNAME=null
32+
MAIL_PASSWORD=null
33+
MAIL_ENCRYPTION=null
34+
MAIL_FROM_ADDRESS=akhileshdarjee@gmail.com
35+
MAIL_FROM_NAME="${APP_NAME}"
36+
37+
AWS_ACCESS_KEY_ID=
38+
AWS_SECRET_ACCESS_KEY=
39+
AWS_DEFAULT_REGION=us-east-1
40+
AWS_BUCKET=
41+
42+
PUSHER_APP_ID=
43+
PUSHER_APP_KEY=
44+
PUSHER_APP_SECRET=
45+
PUSHER_APP_CLUSTER=mt1
46+
47+
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
48+
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.scss linguist-vendored
4+
*.js linguist-vendored
5+
CHANGELOG.md export-ignore

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/node_modules
2+
/public/hot
3+
/public/storage
4+
/storage/*.key
5+
/vendor
6+
.env
7+
.env.backup
8+
.phpunit.result.cache
9+
Homestead.json
10+
Homestead.yaml
11+
npm-debug.log
12+
yarn-error.log
13+
.DS_Store

.styleci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
php:
2+
preset: laravel
3+
disabled:
4+
- unused_use
5+
finder:
6+
not-name:
7+
- index.php
8+
- server.php
9+
js:
10+
finder:
11+
not-name:
12+
- webpack.mix.js
13+
css: true

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<div align="center">
2+
<img src="/public/img/logo-big.svg">
3+
</div>
4+
5+
## Installation
6+
7+
1. `git clone -b master https://github.com/akhileshdarjee/origin-cms.git`
8+
9+
2. Update new git project URL
10+
11+
3. `composer install`
12+
13+
4. `cp .env.example .env`
14+
15+
5. `php artisan key:generate`
16+
17+
6. (Optional) Naming your app - `php artisan app:name {YOUR_APP_NAME}`
18+
19+
7. Set database credentials in '.env' file
20+
21+
8. `composer dumpautoload -o`
22+
23+
9. `php artisan migrate:refresh --seed`
24+
25+
10. `php artisan storage:link`
26+
27+
28+
## Permissions
29+
30+
### Local (Development)
31+
32+
```
33+
cd /path/to/your/laravel/directory
34+
sudo find . -type f -exec chmod 664 {} \;
35+
sudo find . -type d -exec chmod 755 {} \;
36+
37+
sudo chown -R :www-data bootstrap/cache
38+
sudo chmod -R ug+rwx bootstrap/cache
39+
sudo chown -R :www-data storage/
40+
sudo chmod -R ug+rwx storage/
41+
sudo chown -R :www-data app/
42+
sudo chmod -R ug+rwx app/
43+
sudo chown -R :www-data database/migrations
44+
sudo chmod -R ug+rwx database/migrations
45+
```
46+
47+
### Production (Server)
48+
49+
```
50+
cd /path/to/your/laravel/directory
51+
sudo find . -type f -exec chmod 664 {} \;
52+
sudo find . -type d -exec chmod 755 {} \;
53+
54+
sudo chown -R :www-data bootstrap/cache
55+
sudo chmod -R ug+rwx bootstrap/cache
56+
sudo chown -R :www-data storage/
57+
sudo chmod -R ug+rwx storage/
58+
```
59+
60+
61+
Now, you've completed the configuration step :v:
62+
63+
11. Serve it on your local server, `php artisan serve --port=8081`
64+
65+
12. Hit the URL: http://localhost:8081/admin
66+
67+
## Login Credentials:
68+
69+
System Administrator
70+
71+
**Login ID**: sysadmin
72+
**Password**: sysadmin@111
73+
74+
Administrator
75+
76+
**Login ID**: admin
77+
**Password**: admin@111
78+
79+
80+
Enjoy...!!! :thumbsup:

app/Activity.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace App;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
7+
class Activity extends Model
8+
{
9+
/**
10+
* The database table used by the model.
11+
*
12+
* @var string
13+
*/
14+
protected $table = 'oc_activity';
15+
16+
/**
17+
* The attributes that are mass assignable.
18+
*
19+
* @var array
20+
*/
21+
protected $fillable = [
22+
'user_id', 'user', 'module', 'icon', 'action', 'form_id',
23+
'form_title', 'owner', 'last_updated_by'
24+
];
25+
}

app/Console/Commands/OriginBackup.php

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use DB;
6+
use Illuminate\Support\Str;
7+
use Illuminate\Console\Command;
8+
use Symfony\Component\Process\Process;
9+
use Symfony\Component\Process\Exception\ProcessFailedException;
10+
11+
class OriginBackup extends Command
12+
{
13+
/**
14+
* The name and signature of the console command.
15+
*
16+
* @var string
17+
*/
18+
protected $signature = 'origin:backup
19+
{--d|only-db : Backup only database}
20+
{--f|only-files : Backup only files}';
21+
22+
/**
23+
* The console command description.
24+
*
25+
* @var string
26+
*/
27+
protected $description = 'Backup database & all user uploaded files';
28+
29+
/**
30+
* Create a new command instance.
31+
*
32+
* @return void
33+
*/
34+
public function __construct()
35+
{
36+
parent::__construct();
37+
38+
$this->backup_name = Str::random(40);
39+
40+
$this->process = new Process(sprintf(
41+
'mysqldump -u%s -p%s %s > %s',
42+
config('database.connections.mysql.username'),
43+
config('database.connections.mysql.password'),
44+
config('database.connections.mysql.database'),
45+
storage_path('app/backups/' . $this->backup_name . '.sql')
46+
));
47+
}
48+
49+
/**
50+
* Execute the console command.
51+
*
52+
* @return mixed
53+
*/
54+
public function handle()
55+
{
56+
try {
57+
$enable_backups = DB::table('oc_settings')
58+
->select('field_name', 'field_value')
59+
->where('field_name', 'enable_backups')
60+
->where('owner', 'admin')
61+
->first();
62+
63+
if ($enable_backups) {
64+
if (intval($enable_backups->field_value)) {
65+
if ($this->option('only-db') && $this->option('only-files')) {
66+
$this->error('Please use only one option, -d for database or -f for files');
67+
} else {
68+
if ($this->option('only-db') || $this->option('only-files')) {
69+
if ($this->option('only-db')) {
70+
$this->process->mustRun(); // backup mysql database
71+
} elseif ($this->option('only-files')) {
72+
$this->backupFiles(); // backup user uploaded files
73+
}
74+
} else {
75+
$this->process->mustRun(); // backup mysql database
76+
$this->backupFiles(true); // backup user uploaded files
77+
}
78+
79+
$this->info('Backup has been created successfully.');
80+
}
81+
} else {
82+
$this->error('Backups are not enabled. Please enable it from Settings');
83+
}
84+
} else {
85+
$this->error('Backups are not enabled. Please enable it from Settings');
86+
}
87+
} catch (ProcessFailedException $e) {
88+
logger()->error('Backup process failed: ' . $e->getMessage());
89+
$this->error('Backup process has been failed.');
90+
}
91+
}
92+
93+
public function backupFiles($db = false)
94+
{
95+
$source = storage_path('app/public/uploads');
96+
$destination = storage_path('app/backups/' . $this->backup_name . '.zip');
97+
98+
if (extension_loaded('zip') === true) {
99+
if (file_exists($source) === true) {
100+
$zip = new \ZipArchive();
101+
102+
if ($zip->open($destination, \ZipArchive::CREATE | \ZipArchive::OVERWRITE)) {
103+
$files = new \RecursiveIteratorIterator(
104+
new \RecursiveDirectoryIterator($source),
105+
\RecursiveIteratorIterator::LEAVES_ONLY
106+
);
107+
108+
$files->setFlags(\RecursiveDirectoryIterator::SKIP_DOTS);
109+
110+
foreach ($files as $name => $file) {
111+
if (!$file->isDir()) {
112+
$filePath = $file->getRealPath();
113+
$relativePath = substr($filePath, strlen($source) + 1);
114+
115+
if ($zip->addFile($filePath, 'uploads/' . $relativePath)) {
116+
continue;
117+
}
118+
}
119+
}
120+
121+
if ($db && $zip->addEmptyDir('db')) {
122+
$db_backup_file = storage_path('app/backups/' . $this->backup_name . '.sql');
123+
$zip->addFile($db_backup_file, 'db/' . $this->backup_name . '.sql');
124+
$zip->setArchiveComment('Database & Files');
125+
} else {
126+
$zip->setArchiveComment('Files');
127+
}
128+
129+
$zip->close();
130+
131+
if ($db && file_exists(storage_path('app/backups/' . $this->backup_name . '.sql'))) {
132+
unlink(storage_path('app/backups/' . $this->backup_name . '.sql'));
133+
}
134+
}
135+
}
136+
}
137+
}
138+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use Artisan;
6+
use Illuminate\Console\Command;
7+
8+
class OriginMigrate extends Command
9+
{
10+
/**
11+
* The name and signature of the console command.
12+
*
13+
* @var string
14+
*/
15+
protected $signature = 'origin:migrate';
16+
17+
/**
18+
* The console command description.
19+
*
20+
* @var string
21+
*/
22+
protected $description = 'Call migration and reset app modules';
23+
24+
/**
25+
* Create a new command instance.
26+
*
27+
* @return void
28+
*/
29+
public function __construct()
30+
{
31+
parent::__construct();
32+
}
33+
34+
/**
35+
* Execute the console command.
36+
*
37+
* @return mixed
38+
*/
39+
public function handle()
40+
{
41+
Artisan::call('migrate');
42+
cache()->forget('app_modules');
43+
}
44+
}

0 commit comments

Comments
 (0)