Skip to content

Commit

Permalink
Merge pull request #7 from damnstupidsimple/develop-0.3.0
Browse files Browse the repository at this point in the history
Release candidate 0.3.1
  • Loading branch information
Fariz Luqman authored Jan 22, 2017
2 parents c7090f7 + 9a3874f commit 5225636
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 42 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
vendor/*
vendor/*
.idea/*
6 changes: 3 additions & 3 deletions app/Controller/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
namespace Controller;

use Sentry;
use Core\Viewer;
use Core\Response;
use Viewer;
use Response;

class Admin {

Expand All @@ -21,4 +21,4 @@ public function displayAdminPage(){
Viewer::file('/resources/views/admin/home');
}

}
}
8 changes: 4 additions & 4 deletions app/Controller/Auth.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
namespace Controller;
use Sentry;
use Core\Response;
use Core\Viewer;
use Response;
use Viewer;

class Auth {
public function __construct(){

}

public function displayRegisterPage(){
Expand Down Expand Up @@ -82,4 +82,4 @@ public function doLogout(){

}

}
}
16 changes: 8 additions & 8 deletions app/Controller/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
namespace Controller;

use Sentry;
use Core\Viewer;
use Core\Response;
use Viewer;
use Response;

class User {

Expand All @@ -13,7 +13,7 @@ public function __construct(){
Response::redirect('login');
}
}

public function editUser(){
$id = Response::get('id');
$first_name = Response::get('first_name');
Expand Down Expand Up @@ -71,20 +71,20 @@ public function editUser(){
public function deleteUser()
{
$id = Response::get('id');
try
try
{
$user = \Model\User::find($id);

if($user === null){
Response::redirect('admin?delete=failed');
}

$user->delete();
}catch(Exception $e)
{
Response::redirect('admin?delete=failed');
}

Response::redirect('admin?delete=success');
}
}
}
10 changes: 6 additions & 4 deletions app/Service/Test/TestService.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php
namespace Service\Test;

class TestService extends \Core\Service
use ServiceContainer;

class TestService extends ServiceContainer
{
public function hello()
{
return 'Hello';
}

public function calculate(int $var1, $operation, int $var2)
{
if($operation == 'plus' || $operation == '+')
Expand All @@ -26,9 +28,9 @@ public function calculate(int $var1, $operation, int $var2)
return 'Invalid Operation';
}
}

public function getRegisteredUsers()
{
return \Model\User::all();
}
}
}
44 changes: 25 additions & 19 deletions app/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
*/
Core\Alias::init();

/*
|--------------------------------------------------------------------------
| Set the default timezone
|--------------------------------------------------------------------------
|
| Reads the configuration file (config/datetime.php) and set timezone
|
*/
TimeTrackr::init();

/*
|--------------------------------------------------------------------------
| Creating the Singleton
Expand All @@ -29,11 +39,7 @@
| maintaining only one instantiation of a class.
|
*/
$app = new Core\App;


date_default_timezone_set ( 'Asia/Kuala_Lumpur' );

$app = new App;

/*
|--------------------------------------------------------------------------
Expand All @@ -43,7 +49,7 @@
| Connect the database for only once. Save the planet.
|
*/
$app->link('database', Core\Database::connect());
$app->link('database', Database::connect());

/*
|--------------------------------------------------------------------------
Expand All @@ -54,29 +60,29 @@
| capabilities.
|
*/
$app->link('cachemanager', Core\Cache::init());
$app->link('cachemanager', Cache::init());

/*
|--------------------------------------------------------------------------
| Share the Singleton $app with the Template Files
| Load Services
|--------------------------------------------------------------------------
|
| Eliminate complexity, get the job done.
| This is where all of your applications in /app/Service are loaded.
|
*/
Core\Sharer::share('app', $app);
$service = Service::loadServices();

/*
|--------------------------------------------------------------------------
| Load Services
| Share the Singleton $app and $service
|--------------------------------------------------------------------------
|
| This is where all of your applications resides
| Eliminate complexity, get the job done. Our Dependency Injection (DI) is
| here!
|
*/
$service = Core\Service::loadServices();

Core\Sharer::share('service', $service);
Sharer::share('app', $app);
Sharer::share('service', $service);

/*
|--------------------------------------------------------------------------
Expand All @@ -87,8 +93,8 @@
|
*/

Core\Router::start();
Core\Router::dispatch();
Router::start();
Router::dispatch();

/*
|--------------------------------------------------------------------------
Expand All @@ -100,5 +106,5 @@
|
*/
if(getenv('SHOW_EXECUTION_TIME')){
Core\Debugger::exec_time();
}
Debugger::exec_time();
}
6 changes: 5 additions & 1 deletion config/aliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
'Core\Database' => 'Database',
'Core\Debugger' => 'Debugger',
'Core\Router' => 'Router',
'Core\Response' => 'Response',
'Core\Sharer' => 'Sharer',
'Core\Viewer' => 'Viewer',
'Core\Service' => 'Service',
'Core\Service\ServiceContainer' => 'ServiceContainer',
'Core\TimeTrackr' => 'TimeTrackr',
'Cartalyst\Sentry\Facades\Native\Sentry' => 'Sentry'
];
];
4 changes: 2 additions & 2 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
* @link https://www.studionexus.co/php/damnstupidsimple
*/

return
return
[
'enabled' => true,
'settings' =>
'settings' =>
[
'host' => 'localhost',
'driver' => 'mysql',
Expand Down
6 changes: 6 additions & 0 deletions config/timetrackr.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

return
[
'timezone' => 'Asia/Kuala_Lumpur'
];

0 comments on commit 5225636

Please sign in to comment.