Skip to content

Commit

Permalink
add: composer autoload
Browse files Browse the repository at this point in the history
  • Loading branch information
FarrelAD committed Nov 30, 2024
1 parent efce67f commit f8a9431
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 33 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.env
.env
/vendor/
2 changes: 1 addition & 1 deletion app/config/config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

define("DB_SERVER","");
define("DB_NAME","db_temp_finalis_jti");
define("DB_NAME","finalis_jti");
define("DB_USER","");
define("DB_PASSWORD","");
3 changes: 0 additions & 3 deletions app/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace App\Controllers;

require_once __DIR__ . '/../core/Controller.php';


use App\Core\Controller;


Expand Down
3 changes: 0 additions & 3 deletions app/controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace App\Controllers;

require_once __DIR__ . '/../core/Controller.php';
require_once __DIR__ . '/../models/Admin.php';

use App\Core\Controller;
use App\Models\Admin;

Expand Down
2 changes: 0 additions & 2 deletions app/controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace App\Controllers;

require_once __DIR__ . '/../core/Controller.php';

use App\Core\Controller;

class HomeController extends Controller {
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/StudentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace App\Controllers;

require_once __DIR__ . '/../core/Controller.php';


use App\Core\Controller;


Expand Down
2 changes: 0 additions & 2 deletions app/core/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

namespace App\Core;

require_once __DIR__ . '/../config/config.php';

use PDO;
use PDOException;
use PDOStatement;
Expand Down
4 changes: 0 additions & 4 deletions app/core/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

namespace App\Core;

require_once __DIR__ . '/Database.php';
require_once __DIR__ . '/Controller.php';
require_once __DIR__ . '/Model.php';

class Router
{

Expand Down
7 changes: 2 additions & 5 deletions app/models/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@

namespace App\Models;

require_once __DIR__ . '/../core/Model.php';

use PDO;
use App\Core\Model;


class Admin extends Model {
public function checkUserIsAvailable(string $username, string $password): bool|array {
$query = "SELECT * FROM Admin WHERE name = ? AND password = ?";
$query = "SELECT * FROM USERS.Admin WHERE nama_lengkap = ? AND password = ?";

$stmt = $this->db->prepareQuery($query);
$stmt->bindParam(1, $username);
$stmt->bindParam(2, $password);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
return ($result === false) ? false : $result;
return $stmt->fetch(PDO::FETCH_ASSOC);
}
}
2 changes: 0 additions & 2 deletions app/models/Students.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace App\Models;

require_once __DIR__ . '/../core/Model.php';

use App\Core\Model;


Expand Down
3 changes: 1 addition & 2 deletions app/routes/api.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

require_once __DIR__ . '/../core/Router.php';
require_once __DIR__ . '/../controllers/AuthController.php';
require_once __DIR__ . '/../../vendor/autoload.php';

use App\Core\Router;
use App\Controllers\AuthController;
Expand Down
6 changes: 1 addition & 5 deletions app/routes/web.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<?php

require_once __DIR__ . '/../core/Router.php';
require_once __DIR__ . '/../controllers/HomeController.php';
require_once __DIR__ . '/../controllers/AuthController.php';
require_once __DIR__ . '/../controllers/StudentsController.php';
require_once __DIR__ . '/../controllers/AdminController.php';
require_once __DIR__ . '/../../vendor/autoload.php';

use App\Core\Router;
use App\Controllers\{HomeController, AuthController, StudentsController, AdminController};
Expand Down
20 changes: 20 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "andromeda-hebat/finalis-jti-web",
"description": "FINALIS JTI WEB is a web based information system for tracking and managing task clearances related to final projects, tailored for Information Technology Department at Politeknik negeri Malang",
"authors": [
{
"name": "Farrel Augusta Dinata",
"email": "[email protected]"
},
{
"name": "Stevan Zaky Setyanto",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
"require": {}
}

0 comments on commit f8a9431

Please sign in to comment.