Skip to content

Commit 379fb23

Browse files
committed
added my php structer and added
1 parent 09f557f commit 379fb23

File tree

74 files changed

+990
-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.

74 files changed

+990
-0
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

financeTrackerBackend/.env-example

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
APP_NAME=FinanceTracker
2+
APP_ENV=local
3+
DB_HOST=localhost
4+
DB_NAME=****
5+
DB_USER=****
6+
DB_PASS=****

financeTrackerBackend/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.env
2+
/vendor
3+
/storage

financeTrackerBackend/.htaccess

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
RewriteEngine On
2+
RewriteBase /
3+
RewriteCond %{REQUEST_FILENAME} !-d
4+
RewriteCond %{REQUEST_FILENAME} !-f
5+
RewriteRule ^(.+)$ khabary/index.php [QSA,L]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
namespace Admin;
4+
5+
6+
class Admin
7+
{
8+
protected $currentDomain;
9+
protected $basePath;
10+
function __construct()
11+
{
12+
$this->currentDomain = CURRENT_DOMAIN;
13+
$this->basePath = BASE_PATH;
14+
}
15+
16+
protected function redirect($url)
17+
{
18+
header('Location: ' . trim($this->currentDomain, '/ ') . '/' . trim($url, '/ '));
19+
exit;
20+
}
21+
22+
protected function redirectBack()
23+
{
24+
header('Location: ' . $_SERVER['HTTP_REFERER']);
25+
exit;
26+
}
27+
28+
protected function saveImage($image, $imagePath, $imageName = null)
29+
{
30+
31+
if ($imageName) {
32+
$extension = explode('/', $image['type'][1]);
33+
$imageName = $imageName . '.' . $extension;
34+
} else {
35+
$extension = explode('/', $image['type'][1]);
36+
$imageName = date("Y-m-d-H-i-s") . '.' . $extension;
37+
}
38+
39+
$imageTemp = $image['tmp_name'];
40+
$imagePath = 'public/' . $imagePath . '/';
41+
42+
if (is_uploaded_file($imageTemp)) {
43+
if (move_uploaded_file($imageTemp, $imagePath . $imageName)) {
44+
return $imagePath . $imageName;
45+
} else {
46+
return false;
47+
}
48+
} else {
49+
return false;
50+
}
51+
52+
}
53+
54+
protected function removeImage($path)
55+
{
56+
$path = trim($this->basePath, '/ ') . '/' . trim($path, '/ ');
57+
if (file_exists($path)) {
58+
unlink($path);
59+
}
60+
}
61+
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Admin;
4+
5+
class Category {
6+
7+
public function index()
8+
{
9+
10+
}
11+
}

financeTrackerBackend/activities/Home.php

Whitespace-only changes.

financeTrackerBackend/composer.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "root/finance-tracker-backend",
3+
"description": "A simple backend for managing finance data.",
4+
"autoload": {
5+
"psr-4": {
6+
"Root\\FinanceTrackerBackend\\": "src/"
7+
}
8+
},
9+
"authors": [
10+
{
11+
"name": "HassanAliAskari"
12+
}
13+
],
14+
"require": {
15+
"vlucas/phpdotenv": "^5.6"
16+
}
17+
}

0 commit comments

Comments
 (0)