Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
akaunting 3.0 (the last dance)
  • Loading branch information
brkcvn committed Jun 1, 2022
1 parent cead09f commit d9c0764
Show file tree
Hide file tree
Showing 3,812 changed files with 127,969 additions and 104,087 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 6 additions & 0 deletions .env.example
Expand Up @@ -19,7 +19,10 @@ BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_CONNECTION=sync

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

MAIL_MAILER=mail
MAIL_HOST=localhost
Expand All @@ -33,3 +36,6 @@ MAIL_FROM_ADDRESS=null
FIREWALL_ENABLED=false

MODEL_CACHE_ENABLED=false

DEBUGBAR_EDITOR=vscode
IGNITION_EDITOR=vscode
14 changes: 14 additions & 0 deletions .git-ftp-ignore
@@ -0,0 +1,14 @@
.gitignore
.gitattributes
.git-ftp-ignore
.git-ftp-include
.git-ftp-log
.gitlab-ci.yml
.ftpquota
.git/*
.github/*
.public/js/*
.vendor/*
.node_modules/*

composer.lock
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
@@ -1,7 +1,7 @@
name: Tests

on:
push:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
Expand All @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
php: ['7.3', '7.4']
php: ['8.0', '8.1']

steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -85,7 +85,6 @@ Homestead.json
Homestead.yaml
npm-debug.log
.env
.env.example
robots.txt
_ide_helper.php
_ide_helper_models.php
Expand All @@ -95,3 +94,4 @@ _ide_helper_models.php
modules/*
!modules/.gitkeep
.laravelstatsrc
.DS_Store
14 changes: 2 additions & 12 deletions README.md
Expand Up @@ -6,7 +6,7 @@
[![Tests](https://img.shields.io/github/workflow/status/akaunting/akaunting/Tests?label=tests)](https://github.com/akaunting/akaunting/actions)
[![License](https://img.shields.io/github/license/akaunting/akaunting?label=license)](LICENSE.txt)

Akaunting is a free, open source and online accounting software designed for small businesses and freelancers. It is built with modern technologies such as Laravel, VueJS, Bootstrap 4, RESTful API etc. Thanks to its modular structure, Akaunting provides an awesome App Store for users and developers.
Akaunting is a free, open source and online accounting software designed for small businesses and freelancers. It is built with modern technologies such as Laravel, VueJS, Tailwind, RESTful API etc. Thanks to its modular structure, Akaunting provides an awesome App Store for users and developers.

* [Home](https://akaunting.com) - The house of Akaunting
* [Forum](https://akaunting.com/forum) - Ask for support
Expand All @@ -17,7 +17,7 @@ Akaunting is a free, open source and online accounting software designed for sma

## Requirements

* PHP 7.3 or higher
* PHP 8.0 or higher
* Database (eg: MySQL, PostgreSQL, SQLite)
* Web Server (eg: Apache, Nginx, IIS)
* [Other libraries](https://akaunting.com/docs/requirements)
Expand Down Expand Up @@ -65,16 +65,6 @@ Please review [our security policy](https://github.com/akaunting/akaunting/secur
* [Cüneyt Şentürk](https://github.com/cuneytsenturk)
* [All Contributors](../../contributors)

## Partners

Each of our partners can help you craft a beautiful, well-architected project. Feel free to get in [contact](https://akaunting.com/contact) with us to become a partner.

* [Creative Tim](https://www.creative-tim.com) is our design partner since Akaunting 2.0 version. They create beautiful UI Kits, Templates, and Dashboards built on top of Bootstrap, Vue.js, React, Angular, Node.js, and Laravel.

## Sponsors

Support Akaunting by becoming a sponsor on [Patreon](https://www.patreon.com/akaunting). Your logo will show up here with a link to your website.

## License

Akaunting is released under the [GPLv3 license](LICENSE.txt).
58 changes: 42 additions & 16 deletions app/Abstracts/BulkAction.php
Expand Up @@ -18,28 +18,54 @@ abstract class BulkAction
public $model = false;

public $actions = [
'enable' => [
'name' => 'general.enable',
'message' => 'bulk_actions.message.enable',
'permission' => 'update-common-items',
'enable' => [
'name' => 'general.enable',
'message' => 'bulk_actions.message.enable',
'permission' => 'update-common-items',
],
'disable' => [
'name' => 'general.disable',
'message' => 'bulk_actions.message.disable',
'permission' => 'update-common-items',
'disable' => [
'name' => 'general.disable',
'message' => 'bulk_actions.message.disable',
'permission' => 'update-common-items',
],
'delete' => [
'name' => 'general.delete',
'message' => 'bulk_actions.message.delete',
'permission' => 'delete-common-items',
'delete' => [
'name' => 'general.delete',
'message' => 'bulk_actions.message.delete',
'permission' => 'delete-common-items',
],
'export' => [
'name' => 'general.export',
'message' => 'bulk_actions.message.export',
'type' => 'download'
'export' => [
'name' => 'general.export',
'message' => 'bulk_actions.message.export',
'type' => 'download'
],
];

public $icons = [
'enable' => 'check_circle',
'disable' => 'hide_source',
'delete' => 'delete',
'export' => 'file_download',
'reconcile' => 'published_with_changes',
'unreconcile' => 'layers_clear',
'received' => 'call_received',
'cancelled' => 'cancel',
'sent' => 'send',
'approved' => 'approval',
'refused' => 'do_not_disturb_on',
'issued' => 'mark_email_read',
'confirmed' => 'thumb_up_alt',
];

public $messages = [
'general' => 'bulk_actions.success.general',
'enable' => 'messages.success.enabled',
'disable' => 'messages.success.disabled',
'delete' => 'messages.success.deleted',
'duplicate' => 'messages.success.duplicated',
'invite' => 'messages.success.invited',
'end' => 'messages.success.ended',
];

public function getSelectedRecords($request, $relationships = null)
{
if (empty($relationships)) {
Expand Down
39 changes: 35 additions & 4 deletions app/Abstracts/Factory.php
Expand Up @@ -5,6 +5,7 @@
use App\Models\Auth\User;
use App\Models\Common\Company;
use App\Traits\Jobs;
use Closure;
use Illuminate\Database\Eloquent\Factories\Factory as BaseFactory;
use Illuminate\Database\Eloquent\Model as EloquentModel;

Expand All @@ -28,16 +29,46 @@ public function __construct(...$arguments)

config(['mail.default' => 'array']);

// TODO: this location was put to make US | for "gmail.co.uk" issue
$this->faker = \Faker\Factory::create();

$this->setUser();

$this->setCompany();
}

public function getCompanyUsers(): array
{
return $this->company->users()->enabled()->get()->pluck('id')->toArray();
}

public function company(int $id): static
{
return $this->state([
'company_id' => $id,
]);
}

public function setUser(): void
{
$this->user = User::first();
$this->company = $this->user->companies()->first();
}

company($this->company->id)->makeCurrent();
public function setCompany(): void
{
$company_id = $this->getRawAttribute('company_id');

$this->company = !empty($company_id) ? Company::find($company_id) : $this->user->companies()->first();

$this->company->makeCurrent();

app('url')->defaults(['company_id' => company_id()]);
}

public function getCompanyUsers()
public function getRawAttribute($key)
{
return $this->company->users()->enabled()->get()->pluck('id')->toArray();
$raw = $this->state([])->getExpandedAttributes(null);

return $raw[$key] ?? null;
}
}
150 changes: 147 additions & 3 deletions app/Abstracts/Http/ApiController.php
Expand Up @@ -5,16 +5,18 @@
use App\Traits\Jobs;
use App\Traits\Permissions;
use App\Traits\Relationships;
use Dingo\Api\Exception\ResourceException;
use Dingo\Api\Routing\Helpers;
use App\Exceptions\Http\Resource as ResourceException;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller as BaseController;
use Symfony\Component\HttpKernel\Exception\HttpException;

abstract class ApiController extends BaseController
{
use AuthorizesRequests, Jobs, Helpers, Permissions, Relationships, ValidatesRequests;
use AuthorizesRequests, Jobs, Permissions, Relationships, ValidatesRequests;

/**
* Instantiate a new controller instance.
Expand All @@ -39,4 +41,146 @@ protected function buildFailedValidationResponse(Request $request, array $errors

return redirect()->to($this->getRedirectUrl())->withInput($request->input())->withErrors($errors, $this->errorBag());
}

/**
* Respond with a location and a created resource.
*
* @param string $location
* @param object $resource
*
* @return \Illuminate\Http\JsonResponse
*/
public function created($location, $resource): JsonResponse
{
return $resource
->response()
->setStatusCode(201)
->header('Location', $location);
}

/**
* Respond with a location and an accepted resource.
*
* @param string $location
* @param object $resource
*
* @return \Illuminate\Http\JsonResponse
*/
public function accepted($location, $resource): JsonResponse
{
return $resource
->response()
->setStatusCode(202)
->header('Location', $location);
}

/**
* Respond with empty content.
*
* @return \Illuminate\Http\Response
*/
public function noContent(): Response
{
return (new Response)
->setStatusCode(204);
}

/**
* Return an error response.
*
* @param string $message
* @param int $statusCode
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
*
* @return void
*/
public function error($message, $statusCode)
{
throw new HttpException($statusCode, $message);
}

/**
* Return a 404 not found error.
*
* @param string $message
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
*
* @return void
*/
public function errorNotFound($message = 'Not Found')
{
$this->error($message, 404);
}

/**
* Return a 400 bad request error.
*
* @param string $message
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
*
* @return void
*/
public function errorBadRequest($message = 'Bad Request')
{
$this->error($message, 400);
}

/**
* Return a 403 forbidden error.
*
* @param string $message
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
*
* @return void
*/
public function errorForbidden($message = 'Forbidden')
{
$this->error($message, 403);
}

/**
* Return a 500 internal server error.
*
* @param string $message
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
*
* @return void
*/
public function errorInternal($message = 'Internal Error')
{
$this->error($message, 500);
}

/**
* Return a 401 unauthorized error.
*
* @param string $message
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
*
* @return void
*/
public function errorUnauthorized($message = 'Unauthorized')
{
$this->error($message, 401);
}

/**
* Return a 405 method not allowed error.
*
* @param string $message
*
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
*
* @return void
*/
public function errorMethodNotAllowed($message = 'Method Not Allowed')
{
$this->error($message, 405);
}
}

0 comments on commit d9c0764

Please sign in to comment.