laravel 8

This commit is contained in:
Denis Duliçi 2020-10-14 17:07:59 +03:00
parent b4e044b199
commit 1ba8835a2d
134 changed files with 3515 additions and 1952 deletions

View File

@ -15,7 +15,7 @@ jobs:
strategy: strategy:
matrix: matrix:
php: ['7.2', '7.3', '7.4'] php: ['7.3', '7.4']
steps: steps:
- name: Checkout code - name: Checkout code

View File

@ -16,7 +16,7 @@ Akaunting is a free, open source and online accounting software designed for sma
## Requirements ## Requirements
* PHP 7.2.5 or higher * PHP 7.3 or higher
* Database (eg: MySQL, PostgreSQL, SQLite) * Database (eg: MySQL, PostgreSQL, SQLite)
* Web Server (eg: Apache, Nginx, IIS) * Web Server (eg: Apache, Nginx, IIS)
* [Other libraries](https://akaunting.com/docs/requirements) * [Other libraries](https://akaunting.com/docs/requirements)

26
app/Abstracts/Factory.php Normal file
View File

@ -0,0 +1,26 @@
<?php
namespace App\Abstracts;
use App\Models\Auth\User;
use App\Traits\Jobs;
use Illuminate\Database\Eloquent\Factories\Factory as BaseFactory;
abstract class Factory extends BaseFactory
{
use Jobs;
public function __construct()
{
$this->user = User::first();
$this->company = $this->user->companies()->first();
session(['company_id' => $this->company->id]);
setting()->setExtraColumns(['company_id' => $this->company->id]);
}
public function getCompanyUsers()
{
return $this->company->users()->enabled()->get()->pluck('id')->toArray();
}
}

View File

@ -16,7 +16,6 @@ class $NAME$ extends Provider
$this->loadViews(); $this->loadViews();
$this->loadTranslations(); $this->loadTranslations();
$this->loadMigrations(); $this->loadMigrations();
$this->loadFactories();
//$this->loadConfig(); //$this->loadConfig();
} }
@ -60,20 +59,6 @@ class $NAME$ extends Provider
$this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$'); $this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$');
} }
/**
* Load factories.
*
* @return void
*/
public function loadFactories()
{
if (app()->environment('production') || !app()->runningInConsole()) {
return;
}
$this->loadFactoriesFrom(__DIR__ . '/../$FACTORIES_PATH$');
}
/** /**
* Load config. * Load config.
* *

View File

@ -12,7 +12,7 @@ use Throwable;
class Handler extends ExceptionHandler class Handler extends ExceptionHandler
{ {
/** /**
* A list of the exception types that should not be reported. * A list of the exception types that are not reported.
* *
* @var array * @var array
*/ */

View File

@ -14,7 +14,9 @@ class Kernel extends HttpKernel
* @var array * @var array
*/ */
protected $middleware = [ protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class, \App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\MisterPhilip\MaintenanceMode\Http\Middleware\CheckForMaintenanceMode::class, \MisterPhilip\MaintenanceMode\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class, \App\Http\Middleware\TrimStrings::class,
@ -51,7 +53,7 @@ class Kernel extends HttpKernel
'api' => [ 'api' => [
'api.auth', 'api.auth',
'auth.disabled', 'auth.disabled',
'throttle:60,1', 'throttle:api',
'permission:read-api', 'permission:read-api',
'api.company', 'api.company',
'bindings', 'bindings',

View File

@ -3,6 +3,7 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use Closure; use Closure;
use Illuminate\Http\Request;
class RedirectIfAuthenticated class RedirectIfAuthenticated
{ {
@ -11,11 +12,14 @@ class RedirectIfAuthenticated
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
* @param string|null $guard * @param string|null ...$guards
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next, $guard = null) public function handle(Request $request, Closure $next, ...$guards)
{ {
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (auth()->guard($guard)->check()) { if (auth()->guard($guard)->check()) {
$user = user(); $user = user();
@ -25,6 +29,7 @@ class RedirectIfAuthenticated
return redirect()->route($user->landing_page); return redirect()->route($user->landing_page);
} }
}
return $next($request); return $next($request);
} }

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View File

@ -53,7 +53,7 @@ class AddAdminItems
} }
// Sales // Sales
if ($user->can(['read-sales-invoices', 'read-sales-revenues', 'read-sales-customers'])) { if ($user->canAny(['read-sales-invoices', 'read-sales-revenues', 'read-sales-customers'])) {
$menu->dropdown(trim(trans_choice('general.sales', 2)), function ($sub) use ($user, $attr) { $menu->dropdown(trim(trans_choice('general.sales', 2)), function ($sub) use ($user, $attr) {
if ($user->can('read-sales-invoices')) { if ($user->can('read-sales-invoices')) {
$sub->route('invoices.index', trans_choice('general.invoices', 2), [], 10, $attr); $sub->route('invoices.index', trans_choice('general.invoices', 2), [], 10, $attr);
@ -73,7 +73,7 @@ class AddAdminItems
} }
// Purchases // Purchases
if ($user->can(['read-purchases-bills', 'read-purchases-payments', 'read-purchases-vendors'])) { if ($user->canAny(['read-purchases-bills', 'read-purchases-payments', 'read-purchases-vendors'])) {
$menu->dropdown(trim(trans_choice('general.purchases', 2)), function ($sub) use ($user, $attr) { $menu->dropdown(trim(trans_choice('general.purchases', 2)), function ($sub) use ($user, $attr) {
if ($user->can('read-purchases-bills')) { if ($user->can('read-purchases-bills')) {
$sub->route('bills.index', trans_choice('general.bills', 2), [], 10, $attr); $sub->route('bills.index', trans_choice('general.bills', 2), [], 10, $attr);
@ -93,7 +93,7 @@ class AddAdminItems
} }
// Banking // Banking
if ($user->can(['read-banking-accounts', 'read-banking-transfers', 'read-banking-transactions', 'read-banking-reconciliations'])) { if ($user->canAny(['read-banking-accounts', 'read-banking-transfers', 'read-banking-transactions', 'read-banking-reconciliations'])) {
$menu->dropdown(trim(trans('general.banking')), function ($sub) use ($user, $attr) { $menu->dropdown(trim(trans('general.banking')), function ($sub) use ($user, $attr) {
if ($user->can('read-banking-accounts')) { if ($user->can('read-banking-accounts')) {
$sub->route('accounts.index', trans_choice('general.accounts', 2), [], 10, $attr); $sub->route('accounts.index', trans_choice('general.accounts', 2), [], 10, $attr);

View File

@ -0,0 +1,29 @@
<?php
namespace App\Listeners\Update\V20;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use Illuminate\Support\Facades\Artisan;
class Version210 extends Listener
{
const ALIAS = 'core';
const VERSION = '2.1.0';
/**
* Handle the event.
*
* @param $event
* @return void
*/
public function handle(Event $event)
{
if ($this->skipThisUpdate($event)) {
return;
}
Artisan::call('migrate', ['--force' => true]);
}
}

View File

@ -3,6 +3,7 @@
namespace App\Models\Auth; namespace App\Models\Auth;
use App\Traits\Tenants; use App\Traits\Tenants;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Laratrust\Models\LaratrustPermission; use Laratrust\Models\LaratrustPermission;
use Laratrust\Traits\LaratrustPermissionTrait; use Laratrust\Traits\LaratrustPermissionTrait;
use Kyslik\ColumnSortable\Sortable; use Kyslik\ColumnSortable\Sortable;
@ -10,7 +11,7 @@ use Lorisleiva\LaravelSearchString\Concerns\SearchString;
class Permission extends LaratrustPermission class Permission extends LaratrustPermission
{ {
use LaratrustPermissionTrait, SearchString, Sortable, Tenants; use HasFactory, LaratrustPermissionTrait, SearchString, Sortable, Tenants;
protected $table = 'permissions'; protected $table = 'permissions';
@ -80,4 +81,14 @@ class Permission extends LaratrustPermission
return $title; return $title;
} }
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\Permission::new();
}
} }

View File

@ -3,6 +3,7 @@
namespace App\Models\Auth; namespace App\Models\Auth;
use App\Traits\Tenants; use App\Traits\Tenants;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Laratrust\Models\LaratrustRole; use Laratrust\Models\LaratrustRole;
use Laratrust\Traits\LaratrustRoleTrait; use Laratrust\Traits\LaratrustRoleTrait;
use Kyslik\ColumnSortable\Sortable; use Kyslik\ColumnSortable\Sortable;
@ -10,7 +11,7 @@ use Lorisleiva\LaravelSearchString\Concerns\SearchString;
class Role extends LaratrustRole class Role extends LaratrustRole
{ {
use LaratrustRoleTrait, SearchString, Sortable, Tenants; use HasFactory, LaratrustRoleTrait, SearchString, Sortable, Tenants;
protected $table = 'roles'; protected $table = 'roles';
@ -40,4 +41,14 @@ class Role extends LaratrustRole
return $query->usingSearchString($search)->sortable($sort)->paginate($limit); return $query->usingSearchString($search)->sortable($sort)->paginate($limit);
} }
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\Role::new();
}
} }

View File

@ -6,6 +6,7 @@ use App\Traits\Tenants;
use App\Notifications\Auth\Reset; use App\Notifications\Auth\Reset;
use App\Traits\Media; use App\Traits\Media;
use Date; use Date;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
@ -15,7 +16,7 @@ use Lorisleiva\LaravelSearchString\Concerns\SearchString;
class User extends Authenticatable class User extends Authenticatable
{ {
use LaratrustUserTrait, Notifiable, SearchString, SoftDeletes, Sortable, Media, Tenants; use HasFactory, LaratrustUserTrait, Notifiable, SearchString, SoftDeletes, Sortable, Media, Tenants;
protected $table = 'users'; protected $table = 'users';
@ -205,4 +206,14 @@ class User extends Authenticatable
{ {
$this->offsetUnset('company_ids'); $this->offsetUnset('company_ids');
} }
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\User::new();
}
} }

View File

@ -4,10 +4,11 @@ namespace App\Models\Banking;
use App\Abstracts\Model; use App\Abstracts\Model;
use App\Traits\Transactions; use App\Traits\Transactions;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Account extends Model class Account extends Model
{ {
use Transactions; use HasFactory, Transactions;
protected $table = 'accounts'; protected $table = 'accounts';
@ -91,4 +92,14 @@ class Account extends Model
return $total; return $total;
} }
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\Account::new();
}
} }

View File

@ -10,11 +10,12 @@ use App\Traits\Media;
use App\Traits\Recurring; use App\Traits\Recurring;
use App\Traits\Transactions; use App\Traits\Transactions;
use Bkwld\Cloner\Cloneable; use Bkwld\Cloner\Cloneable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Support\Str; use Illuminate\Support\Str;
class Transaction extends Model class Transaction extends Model
{ {
use Cloneable, Currencies, DateTime, Media, Recurring, Transactions; use Cloneable, Currencies, DateTime, HasFactory, Media, Recurring, Transactions;
protected $table = 'transactions'; protected $table = 'transactions';
@ -323,4 +324,14 @@ class Transaction extends Model
{ {
return $value ?? $this->document_id ?? $this->id; return $value ?? $this->document_id ?? $this->id;
} }
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\Transaction::new();
}
} }

View File

@ -4,10 +4,11 @@ namespace App\Models\Banking;
use App\Abstracts\Model; use App\Abstracts\Model;
use App\Traits\Currencies; use App\Traits\Currencies;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Transfer extends Model class Transfer extends Model
{ {
use Currencies; use HasFactory, Currencies;
protected $table = 'transfers'; protected $table = 'transfers';
@ -44,4 +45,14 @@ class Transfer extends Model
{ {
return $this->belongsTo('App\Models\Banking\Account', 'income_transaction.account_id', 'id')->withDefault(['name' => trans('general.na')]); return $this->belongsTo('App\Models\Banking\Account', 'income_transaction.account_id', 'id')->withDefault(['name' => trans('general.na')]);
} }
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\Transfer::new();
}
} }

View File

@ -8,11 +8,12 @@ use App\Traits\Contacts;
use App\Traits\Currencies; use App\Traits\Currencies;
use App\Traits\Media; use App\Traits\Media;
use App\Traits\Transactions; use App\Traits\Transactions;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
class Contact extends Model class Contact extends Model
{ {
use Cloneable, Contacts, Currencies, Media, Notifiable, Transactions; use Cloneable, Contacts, Currencies, HasFactory, Media, Notifiable, Transactions;
protected $table = 'contacts'; protected $table = 'contacts';
@ -144,4 +145,14 @@ class Contact extends Model
return $amount; return $amount;
} }
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\Contact::new();
}
} }

View File

@ -6,10 +6,11 @@ use App\Abstracts\Model;
use App\Traits\Currencies; use App\Traits\Currencies;
use App\Traits\Media; use App\Traits\Media;
use Bkwld\Cloner\Cloneable; use Bkwld\Cloner\Cloneable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Item extends Model class Item extends Model
{ {
use Cloneable, Currencies, Media; use Cloneable, Currencies, HasFactory, Media;
protected $table = 'items'; protected $table = 'items';
@ -137,4 +138,14 @@ class Item extends Model
return $this->getMedia('picture')->last(); return $this->getMedia('picture')->last();
} }
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\Item::new();
}
} }

View File

@ -4,10 +4,11 @@ namespace App\Models\Purchase;
use App\Abstracts\DocumentModel; use App\Abstracts\DocumentModel;
use App\Traits\Purchases; use App\Traits\Purchases;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Bill extends DocumentModel class Bill extends DocumentModel
{ {
use Purchases; use HasFactory, Purchases;
protected $table = 'bills'; protected $table = 'bills';
@ -108,4 +109,14 @@ class Bill extends DocumentModel
return ($received) ? $received->created_at : null; return ($received) ? $received->created_at : null;
} }
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\Bill::new();
}
} }

View File

@ -4,10 +4,11 @@ namespace App\Models\Sale;
use App\Abstracts\DocumentModel; use App\Abstracts\DocumentModel;
use App\Traits\Sales; use App\Traits\Sales;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Invoice extends DocumentModel class Invoice extends DocumentModel
{ {
use Sales; use HasFactory, Sales;
protected $table = 'invoices'; protected $table = 'invoices';
@ -115,4 +116,14 @@ class Invoice extends DocumentModel
return ($sent) ? $sent->created_at : null; return ($sent) ? $sent->created_at : null;
} }
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\Invoice::new();
}
} }

View File

@ -4,10 +4,11 @@ namespace App\Models\Setting;
use App\Abstracts\Model; use App\Abstracts\Model;
use App\Traits\Transactions; use App\Traits\Transactions;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Category extends Model class Category extends Model
{ {
use Transactions; use HasFactory, Transactions;
protected $table = 'categories'; protected $table = 'categories';
@ -130,4 +131,14 @@ class Category extends Model
{ {
return (int) $query->other()->pluck('id')->first(); return (int) $query->other()->pluck('id')->first();
} }
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\Category::new();
}
} }

View File

@ -5,10 +5,11 @@ namespace App\Models\Setting;
use App\Abstracts\Model; use App\Abstracts\Model;
use App\Traits\Contacts; use App\Traits\Contacts;
use App\Traits\Transactions; use App\Traits\Transactions;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Currency extends Model class Currency extends Model
{ {
use Contacts, Transactions; use Contacts, HasFactory, Transactions;
protected $table = 'currencies'; protected $table = 'currencies';
@ -163,4 +164,14 @@ class Currency extends Model
{ {
return $query->where($this->table . '.code', $code); return $query->where($this->table . '.code', $code);
} }
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\Currency::new();
}
} }

View File

@ -3,9 +3,12 @@
namespace App\Models\Setting; namespace App\Models\Setting;
use App\Abstracts\Model; use App\Abstracts\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Tax extends Model class Tax extends Model
{ {
use HasFactory;
protected $table = 'taxes'; protected $table = 'taxes';
/** /**
@ -127,4 +130,14 @@ class Tax extends Model
return $title; return $title;
} }
/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\Tax::new();
}
} }

View File

@ -2,28 +2,12 @@
namespace App\Providers; namespace App\Providers;
use Blade; use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider as Provider; use Illuminate\Support\ServiceProvider as Provider;
use Schema;
class App extends Provider class App extends Provider
{ {
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// Laravel db fix
Schema::defaultStringLength(191);
// @todo Remove the if control after 1.3 update
if (method_exists('Blade', 'withoutDoubleEncoding')) {
Blade::withoutDoubleEncoding();
}
}
/** /**
* Register any application services. * Register any application services.
* *
@ -39,4 +23,17 @@ class App extends Provider
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class); $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
} }
} }
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// Laravel db fix
Schema::defaultStringLength(191);
Paginator::useBootstrap();
}
} }

View File

@ -2,6 +2,8 @@
namespace App\Providers; namespace App\Providers;
use Illuminate\Contracts\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Access\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as Provider; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as Provider;
class Auth extends Provider class Auth extends Provider
@ -12,7 +14,7 @@ class Auth extends Provider
* @var array * @var array
*/ */
protected $policies = [ protected $policies = [
//'App\Model' => 'App\Policies\ModelPolicy', //'App\Models\Model' => 'App\Policies\ModelPolicy',
]; ];
/** /**
@ -24,6 +26,11 @@ class Auth extends Provider
{ {
$this->registerPolicies(); $this->registerPolicies();
// // Register permissions to Laravel Gate
app(Gate::class)->before(function (Authorizable $user, string $ability) {
if (method_exists($user, 'hasPermission')) {
return $user->hasPermission($ability) ?: null;
}
});
} }
} }

View File

@ -25,6 +25,7 @@ class Event extends Provider
'App\Listeners\Update\V20\Version2020', 'App\Listeners\Update\V20\Version2020',
'App\Listeners\Update\V20\Version2023', 'App\Listeners\Update\V20\Version2023',
'App\Listeners\Update\V20\Version2024', 'App\Listeners\Update\V20\Version2024',
'App\Listeners\Update\V21\Version210',
], ],
'Illuminate\Auth\Events\Login' => [ 'Illuminate\Auth\Events\Login' => [
'App\Listeners\Auth\Login', 'App\Listeners\Auth\Login',

View File

@ -2,11 +2,23 @@
namespace App\Providers; namespace App\Providers;
use Illuminate\Support\Facades\Route as Facade; use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as Provider; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as Provider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route as Facade;
class Route extends Provider class Route extends Provider
{ {
/**
* The path to the "home" route for your application.
*
* This is used by Laravel authentication to redirect users after login.
*
* @var string
*/
public const HOME = '/';
/** /**
* This namespace is applied to your controller routes. * This namespace is applied to your controller routes.
* *
@ -64,6 +76,8 @@ class Route extends Provider
*/ */
protected function mapApiRoutes() protected function mapApiRoutes()
{ {
$this->configureRateLimiting();
Facade::prefix('api') Facade::prefix('api')
->namespace($this->namespace) ->namespace($this->namespace)
->group(base_path('routes/api.php')); ->group(base_path('routes/api.php'));
@ -155,4 +169,16 @@ class Route extends Provider
->namespace($this->namespace) ->namespace($this->namespace)
->group(base_path('routes/signed.php')); ->group(base_path('routes/signed.php'));
} }
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60);
});
}
} }

View File

@ -12,7 +12,7 @@
"license": "GPL-3.0+", "license": "GPL-3.0+",
"type": "project", "type": "project",
"require": { "require": {
"php": "^7.2.5", "php": "^7.3.0",
"ext-bcmath": "*", "ext-bcmath": "*",
"akaunting/firewall": "1.2.*", "akaunting/firewall": "1.2.*",
"akaunting/language": "1.0.*", "akaunting/language": "1.0.*",
@ -21,45 +21,45 @@
"akaunting/money": "1.2.*", "akaunting/money": "1.2.*",
"akaunting/setting": "1.2.*", "akaunting/setting": "1.2.*",
"akaunting/version": "1.0.*", "akaunting/version": "1.0.*",
"barryvdh/laravel-debugbar": "3.3.*", "barryvdh/laravel-debugbar": "3.5.*",
"barryvdh/laravel-dompdf": "0.*", "barryvdh/laravel-dompdf": "0.*",
"barryvdh/laravel-ide-helper": "2.8.*", "barryvdh/laravel-ide-helper": "2.8.*",
"bkwld/cloner": "3.7.*", "bkwld/cloner": "3.9.*",
"consoletvs/charts": "6.5.*", "consoletvs/charts": "6.5.*",
"dingo/api": "3.0.*", "dingo/api": "3.0.*",
"doctrine/dbal": "2.9.*", "doctrine/dbal": "2.11.*",
"fideloper/proxy": "^4.2", "fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^1.0", "fruitcake/laravel-cors": "^1.0",
"genealabs/laravel-model-caching": "0.8.*", "genealabs/laravel-model-caching": "0.11.*",
"graham-campbell/markdown": "12.0.*", "graham-campbell/markdown": "13.1.*",
"guzzlehttp/guzzle": "^6.5", "guzzlehttp/guzzle": "^7.0",
"intervention/image": "2.5.*", "intervention/image": "2.5.*",
"intervention/imagecache": "^2.4", "intervention/imagecache": "^2.5",
"kyslik/column-sortable": "^6.0", "kyslik/column-sortable": "^6.0",
"laracasts/flash": "3.1.*", "laracasts/flash": "3.2.*",
"laravel/framework": "^7.0", "laravel/framework": "^8.0",
"laravel/tinker": "^2.0", "laravel/tinker": "^2.0",
"laravel/ui": "^2.0", "laravel/ui": "^3.0",
"laravelcollective/html": "6.1.*", "laravelcollective/html": "6.2.*",
"league/omnipay": "3.0.*", "league/omnipay": "3.1.x-dev",
"lorisleiva/laravel-search-string": "1.0.*", "lorisleiva/laravel-search-string": "1.0.*",
"maatwebsite/excel": "3.1.*", "maatwebsite/excel": "3.1.*",
"misterphilip/maintenance-mode": "2.0.*", "misterphilip/maintenance-mode": "2.0.*",
"monooso/unobserve": "^2.0", "monooso/unobserve": "^3.0",
"plank/laravel-mediable": "4.2.*", "plank/laravel-mediable": "4.4.*",
"riverskies/laravel-mobile-detect": "^1.3", "riverskies/laravel-mobile-detect": "^1.3",
"santigarcor/laratrust": "5.2.*", "santigarcor/laratrust": "6.2.*",
"simshaun/recurr": "4.0.*", "simshaun/recurr": "4.0.*",
"staudenmeir/belongs-to-through": "^2.10", "staudenmeir/belongs-to-through": "^2.11",
"staudenmeir/eloquent-has-many-deep": "^1.12" "staudenmeir/eloquent-has-many-deep": "^1.13"
}, },
"require-dev": { "require-dev": {
"beyondcode/laravel-dump-server": "^1.0", "beyondcode/laravel-dump-server": "^1.5",
"facade/ignition": "^2.0", "facade/ignition": "^2.3",
"fzaninotto/faker": "^1.9.1", "fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1", "mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1", "nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^8.5" "phpunit/phpunit": "^9.3"
}, },
"extra": { "extra": {
"laravel": { "laravel": {
@ -67,13 +67,11 @@
} }
}, },
"autoload": { "autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": { "psr-4": {
"App\\": "app/", "App\\": "app/",
"Modules\\": "modules/", "Modules\\": "modules/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeds\\": "database/seeds/",
"Akaunting\\Module\\Commands\\": "overrides/akaunting/module/Commands/", "Akaunting\\Module\\Commands\\": "overrides/akaunting/module/Commands/",
"Illuminate\\Translation\\": "overrides/Illuminate/Translation/", "Illuminate\\Translation\\": "overrides/Illuminate/Translation/",
"Illuminate\\View\\Concerns\\": "overrides/Illuminate/View/Concerns/", "Illuminate\\View\\Concerns\\": "overrides/Illuminate/View/Concerns/",

2220
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -67,30 +67,6 @@ return [
'expiration_time' => 3600, 'expiration_time' => 3600,
], ],
/*
|--------------------------------------------------------------------------
| Use teams feature in the package
|--------------------------------------------------------------------------
|
| Defines if Laratrust will use the teams feature.
| Please check the docs to see what you need to do in case you have the package already configured.
|
*/
'use_teams' => false,
/*
|--------------------------------------------------------------------------
| Strict check for roles/permissions inside teams
|--------------------------------------------------------------------------
|
| Determines if a strict check should be done when checking if a role or permission
| is attached inside a team.
| If it's false, when checking a role/permission without specifying the team,
| it will check only if the user has attached that role/permission ignoring the team.
|
*/
'teams_strict_check' => false,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Laratrust User Models | Laratrust User Models
@ -132,7 +108,6 @@ return [
* Team model * Team model
*/ */
'team' => 'App\Models\Auth\Team', 'team' => 'App\Models\Auth\Team',
], ],
/* /*
@ -173,7 +148,6 @@ return [
* Permission - Role intermediate table. * Permission - Role intermediate table.
*/ */
'permission_role' => 'role_permissions', 'permission_role' => 'role_permissions',
], ],
/* /*
@ -204,7 +178,6 @@ return [
* Role foreign key on Laratrust's role_user and permission_user tables. * Role foreign key on Laratrust's role_user and permission_user tables.
*/ */
'team' => 'team_id', 'team' => 'team_id',
], ],
/* /*
@ -236,7 +209,8 @@ return [
* Aborts the execution with a 403 code. * Aborts the execution with a 403 code.
*/ */
'abort' => [ 'abort' => [
'code' => 403 'code' => 403,
'message' => 'User does not have any of the necessary access rights.'
], ],
/** /**
* Redirects the user to the given url. * Redirects the user to the given url.
@ -254,14 +228,123 @@ return [
] ]
], ],
'teams' => [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Laratrust Magic 'can' Method | Use teams feature in the package
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Supported cases for the magic can method (Refer to the docs). | Defines if Laratrust will use the teams feature.
| Please check the docs to see what you need to do in case you have the package already configured.
|
*/
'enabled' => false,
/*
|--------------------------------------------------------------------------
| Strict check for roles/permissions inside teams
|--------------------------------------------------------------------------
|
| Determines if a strict check should be done when checking if a role or permission
| is attached inside a team.
| If it's false, when checking a role/permission without specifying the team,
| it will check only if the user has attached that role/permission ignoring the team.
|
*/
'strict_check' => false,
],
/*
|--------------------------------------------------------------------------
| Laratrust Magic 'isAbleTo' Method
|--------------------------------------------------------------------------
|
| Supported cases for the magic is able to method (Refer to the docs).
| Available: camel_case|snake_case|kebab_case | Available: camel_case|snake_case|kebab_case
| |
*/ */
'magic_can_method_case' => 'kebab_case', 'magic_is_able_to_method_case' => 'kebab_case',
/*
|--------------------------------------------------------------------------
| Laratrust Panel
|--------------------------------------------------------------------------
|
| Section to manage everything related with the admin panel for the roles and permissions.
|
*/
'panel' => [
/*
|--------------------------------------------------------------------------
| Laratrust Panel Register
|--------------------------------------------------------------------------
|
| This manages if routes used for the admin panel should be registered.
| Turn this value to false if you don't want to use Laratrust admin panel
|
*/
'register' => false,
/*
|--------------------------------------------------------------------------
| Laratrust Panel Path
|--------------------------------------------------------------------------
|
| This is the URI path where Laratrust panel for roles and permissions
| will be accessible from.
|
*/
'path' => 'laratrust',
/*
|--------------------------------------------------------------------------
| Laratrust Panel Path
|--------------------------------------------------------------------------
|
| The route where the go back link should point
|
*/
'go_back_route' => '/',
/*
|--------------------------------------------------------------------------
| Laratrust Panel Route Middleware
|--------------------------------------------------------------------------
|
| These middleware will get attached onto each Laratrust panel route.
|
*/
'middleware' => ['web'],
/*
|--------------------------------------------------------------------------
| Enable permissions assignment
|--------------------------------------------------------------------------
|
| Enable/Disable the permissions assignment to the users.
|
*/
'assign_permissions_to_user' => true,
/*
|--------------------------------------------------------------------------
| Add restriction to roles in the panel
|--------------------------------------------------------------------------
|
| Configure which roles can not be editable, deletable and removable.
| To add a role to the restriction, use name of the role here.
|
*/
'roles_restrictions' => [
// The user won't be able to remove roles already assigned to users.
'not_removable' => [],
// The user won't be able to edit the role and the permissions assigned.
'not_editable' => [],
// The user won't be able to delete the role.
'not_deletable' => [],
],
],
]; ];

View File

@ -44,13 +44,13 @@ return [
'single' => [ 'single' => [
'driver' => 'single', 'driver' => 'single',
'path' => storage_path('logs/laravel.log'), 'path' => storage_path('logs/laravel.log'),
'level' => 'debug', 'level' => env('LOG_LEVEL', 'debug'),
], ],
'daily' => [ 'daily' => [
'driver' => 'daily', 'driver' => 'daily',
'path' => storage_path('logs/laravel.log'), 'path' => storage_path('logs/laravel.log'),
'level' => 'debug', 'level' => env('LOG_LEVEL', 'debug'),
'days' => 14, 'days' => 14,
], ],
@ -59,12 +59,12 @@ return [
'url' => env('LOG_SLACK_WEBHOOK_URL'), 'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log', 'username' => 'Laravel Log',
'emoji' => ':boom:', 'emoji' => ':boom:',
'level' => 'critical', 'level' => env('LOG_LEVEL', 'critical'),
], ],
'papertrail' => [ 'papertrail' => [
'driver' => 'monolog', 'driver' => 'monolog',
'level' => 'debug', 'level' => env('LOG_LEVEL', 'debug'),
'handler' => SyslogUdpHandler::class, 'handler' => SyslogUdpHandler::class,
'handler_with' => [ 'handler_with' => [
'host' => env('PAPERTRAIL_URL'), 'host' => env('PAPERTRAIL_URL'),
@ -83,12 +83,12 @@ return [
'syslog' => [ 'syslog' => [
'driver' => 'syslog', 'driver' => 'syslog',
'level' => 'debug', 'level' => env('LOG_LEVEL', 'debug'),
], ],
'errorlog' => [ 'errorlog' => [
'driver' => 'errorlog', 'driver' => 'errorlog',
'level' => 'debug', 'level' => env('LOG_LEVEL', 'debug'),
], ],
'null' => [ 'null' => [

View File

@ -42,6 +42,7 @@ return [
'username' => env('MAIL_USERNAME'), 'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'), 'password' => env('MAIL_PASSWORD'),
'timeout' => env('MAIL_TIMEOUT'), 'timeout' => env('MAIL_TIMEOUT'),
'auth_mode' => env('MAIL_AUTH_MODE'),
], ],
'ses' => [ 'ses' => [

View File

@ -81,7 +81,7 @@ return [
*/ */
'failed' => [ 'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database'), 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'), 'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs', 'table' => 'failed_jobs',
], ],

View File

@ -92,10 +92,12 @@ return [
| Session Cache Store | Session Cache Store
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| When using the "apc", "memcached", or "dynamodb" session drivers you may | While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value | list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores". | must match with one of the application's configured cache "stores".
| |
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/ */
'store' => env('SESSION_STORE', null), 'store' => env('SESSION_STORE', null),

View File

@ -1,38 +1,78 @@
<?php <?php
use App\Models\Auth\User; namespace Database\Factories;
use App\Models\Banking\Account;
use Faker\Generator as Faker;
$user = User::first(); use App\Abstracts\Factory;
$company = $user->companies()->first(); use App\Models\Banking\Account as Model;
$factory->define(Account::class, function (Faker $faker) use ($company) { class Account extends Factory
session(['company_id' => $company->id]); {
setting()->setExtraColumns(['company_id' => $company->id]); /**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [ return [
'company_id' => $company->id, 'company_id' => $this->company->id,
'name' => $faker->text(15), 'name' => $this->faker->text(15),
'number' => (string) $faker->iban(), 'number' => (string) $this->faker->iban(),
'currency_code' => $company->currencies()->enabled()->get()->random(1)->pluck('code')->first(), 'currency_code' => $this->company->currencies()->enabled()->get()->random(1)->pluck('code')->first(),
'opening_balance' => '0', 'opening_balance' => '0',
'bank_name' => $faker->text(15), 'bank_name' => $this->faker->text(15),
'bank_phone' => $faker->phoneNumber, 'bank_phone' => $this->faker->phoneNumber,
'bank_address' => $faker->address, 'bank_address' => $this->faker->address,
'enabled' => $faker->boolean ? 1 : 0, 'enabled' => $this->faker->boolean ? 1 : 0,
];
}
/**
* Indicate that the model is enabled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function enabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 1,
]; ];
}); });
}
$factory->state(Account::class, 'enabled', ['enabled' => 1]); /**
* Indicate that the model is disabled.
$factory->state(Account::class, 'disabled', ['enabled' => 0]); *
* @return \Illuminate\Database\Eloquent\Factories\Factory
$factory->state(Account::class, 'default_currency', function (Faker $faker) use ($company) { */
session(['company_id' => $company->id]); public function disabled()
setting()->setExtraColumns(['company_id' => $company->id]); {
return $this->state(function (array $attributes) {
return [
'enabled' => 0,
];
});
}
/**
* Indicate that the default currency is used.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function default_currency()
{
return $this->state(function (array $attributes) {
return [ return [
'currency_code' => setting('default.currency'), 'currency_code' => setting('default.currency'),
]; ];
}); });
}
}

View File

@ -1,26 +1,36 @@
<?php <?php
namespace Database\Factories;
use App\Abstracts\Factory;
use App\Events\Purchase\BillCancelled; use App\Events\Purchase\BillCancelled;
use App\Events\Purchase\BillCreated; use App\Events\Purchase\BillCreated;
use App\Events\Purchase\BillReceived; use App\Events\Purchase\BillReceived;
use App\Jobs\Banking\CreateDocumentTransaction; use App\Jobs\Banking\CreateDocumentTransaction;
use App\Jobs\Purchase\UpdateBill; use App\Jobs\Purchase\UpdateBill;
use App\Models\Auth\User;
use App\Models\Common\Contact; use App\Models\Common\Contact;
use App\Models\Common\Item; use App\Models\Common\Item;
use App\Models\Purchase\Bill; use App\Models\Purchase\Bill as Model;
use App\Models\Setting\Tax; use App\Models\Setting\Tax;
use App\Utilities\Date; use App\Utilities\Date;
use Faker\Generator as Faker;
$user = User::first(); class Bill extends Factory
$company = $user->companies()->first(); {
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
$factory->define(Bill::class, function (Faker $faker) use ($company) { /**
session(['company_id' => $company->id]); * Define the model's default state.
setting()->setExtraColumns(['company_id' => $company->id]); *
* @return array
$billed_at = $faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d H:i:s'); */
public function definition()
{
$billed_at = $this->faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d H:i:s');
$due_at = Date::parse($billed_at)->addDays(10)->format('Y-m-d H:i:s'); $due_at = Date::parse($billed_at)->addDays(10)->format('Y-m-d H:i:s');
$contacts = Contact::vendor()->enabled()->get(); $contacts = Contact::vendor()->enabled()->get();
@ -28,64 +38,136 @@ $factory->define(Bill::class, function (Faker $faker) use ($company) {
if ($contacts->count()) { if ($contacts->count()) {
$contact = $contacts->random(1)->first(); $contact = $contacts->random(1)->first();
} else { } else {
$contact = factory(Contact::class)->states('enabled', 'vendor')->create(); $contact = Contact::factory()->vendor()->enabled()->create();
} }
$statuses = ['draft', 'received', 'partial', 'paid', 'cancelled']; $statuses = ['draft', 'received', 'partial', 'paid', 'cancelled'];
return [ return [
'company_id' => $company->id, 'company_id' => $this->company->id,
'billed_at' => $billed_at, 'billed_at' => $billed_at,
'due_at' => $due_at, 'due_at' => $due_at,
'bill_number' => (string) $faker->randomNumber(5), 'bill_number' => (string) $this->faker->randomNumber(5),
'currency_code' => setting('default.currency'), 'currency_code' => setting('default.currency'),
'currency_rate' => '1', 'currency_rate' => '1',
'notes' => $faker->text(5), 'notes' => $this->faker->text(5),
'category_id' => $company->categories()->expense()->get()->random(1)->pluck('id')->first(), 'category_id' => $this->company->categories()->expense()->get()->random(1)->pluck('id')->first(),
'contact_id' => $contact->id, 'contact_id' => $contact->id,
'contact_name' => $contact->name, 'contact_name' => $contact->name,
'contact_email' => $contact->email, 'contact_email' => $contact->email,
'contact_tax_number' => $contact->tax_number, 'contact_tax_number' => $contact->tax_number,
'contact_phone' => $contact->phone, 'contact_phone' => $contact->phone,
'contact_address' => $contact->address, 'contact_address' => $contact->address,
'status' => $faker->randomElement($statuses), 'status' => $this->faker->randomElement($statuses),
'amount' => '0', 'amount' => '0',
]; ];
}
/**
* Indicate that the model status is draft.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function draft()
{
return $this->state(function (array $attributes) {
return [
'status' => 'draft',
];
}); });
}
$factory->state(Bill::class, 'draft', ['status' => 'draft']); /**
* Indicate that the model status is received.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function received()
{
return $this->state(function (array $attributes) {
return [
'status' => 'received',
];
});
}
$factory->state(Bill::class, 'received', ['status' => 'received']); /**
* Indicate that the model status is partial.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function partial()
{
return $this->state(function (array $attributes) {
return [
'status' => 'partial',
];
});
}
$factory->state(Bill::class, 'partial', ['status' => 'partial']); /**
* Indicate that the model status is paid.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function paid()
{
return $this->state(function (array $attributes) {
return [
'status' => 'paid',
];
});
}
$factory->state(Bill::class, 'paid', ['status' => 'paid']); /**
* Indicate that the model status is cancelled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function cancelled()
{
return $this->state(function (array $attributes) {
return [
'status' => 'cancelled',
];
});
}
$factory->state(Bill::class, 'cancelled', ['status' => 'cancelled']); /**
* Indicate that the model is recurring.
$factory->state(Bill::class, 'recurring', function (Faker $faker) { *
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function recurring()
{
return $this->state(function (array $attributes) {
$frequencies = ['monthly', 'weekly']; $frequencies = ['monthly', 'weekly'];
return [ return [
'recurring_frequency' => 'yes', 'recurring_frequency' => 'yes',
'recurring_interval' => '1', 'recurring_interval' => '1',
'recurring_custom_frequency' => $faker->randomElement($frequencies), 'recurring_custom_frequency' => $this->faker->randomElement($frequencies),
'recurring_count' => '1', 'recurring_count' => '1',
]; ];
}); });
}
$factory->state(Bill::class, 'items', function (Faker $faker) use ($company) { /**
session(['company_id' => $company->id]); * Indicate that the model has items.
setting()->setExtraColumns(['company_id' => $company->id]); *
* @return \Illuminate\Database\Eloquent\Factories\Factory
$amount = $faker->randomFloat(2, 1, 1000); */
public function items()
{
return $this->state(function (array $attributes) {
$amount = $this->faker->randomFloat(2, 1, 1000);
$taxes = Tax::enabled()->get(); $taxes = Tax::enabled()->get();
if ($taxes->count()) { if ($taxes->count()) {
$tax = $taxes->random(1)->first(); $tax = $taxes->random(1)->first();
} else { } else {
$tax = factory(Tax::class)->states('enabled')->create(); $tax = Tax::factory()->enabled()->create();
} }
$items = Item::enabled()->get(); $items = Item::enabled()->get();
@ -93,7 +175,7 @@ $factory->state(Bill::class, 'items', function (Faker $faker) use ($company) {
if ($items->count()) { if ($items->count()) {
$item = $items->random(1)->first(); $item = $items->random(1)->first();
} else { } else {
$item = factory(Item::class)->states('enabled')->create(); $item = Item::factory()->enabled()->create();
} }
$items = [ $items = [
@ -112,25 +194,30 @@ $factory->state(Bill::class, 'items', function (Faker $faker) use ($company) {
'recurring_frequency' => 'no', 'recurring_frequency' => 'no',
]; ];
}); });
}
$factory->afterCreating(Bill::class, function ($bill, $faker) use ($company) { /**
session(['company_id' => $company->id]); * Configure the model factory.
setting()->setExtraColumns(['company_id' => $company->id]); *
* @return $this
*/
public function configure()
{
return $this->afterCreating(function (Model $bill) {
$init_status = $bill->status; $init_status = $bill->status;
$bill->status = 'draft'; $bill->status = 'draft';
event(new BillCreated($bill)); event(new BillCreated($bill));
$bill->status = $init_status; $bill->status = $init_status;
$amount = $faker->randomFloat(2, 1, 1000); $amount = $this->faker->randomFloat(2, 1, 1000);
$taxes = Tax::enabled()->get(); $taxes = Tax::enabled()->get();
if ($taxes->count()) { if ($taxes->count()) {
$tax = $taxes->random(1)->first(); $tax = $taxes->random(1)->first();
} else { } else {
$tax = factory(Tax::class)->states('enabled')->create(); $tax = Tax::factory()->enabled()->create();
} }
$items = Item::enabled()->get(); $items = Item::enabled()->get();
@ -138,7 +225,7 @@ $factory->afterCreating(Bill::class, function ($bill, $faker) use ($company) {
if ($items->count()) { if ($items->count()) {
$item = $items->random(1)->first(); $item = $items->random(1)->first();
} else { } else {
$item = factory(Item::class)->states('enabled')->create(); $item = Item::factory()->enabled()->create();
} }
$items = [ $items = [
@ -157,7 +244,7 @@ $factory->afterCreating(Bill::class, function ($bill, $faker) use ($company) {
'recurring_frequency' => 'no', 'recurring_frequency' => 'no',
]; ];
$updated_bill = dispatch_now(new UpdateBill($bill, $request)); $updated_bill = $this->dispatch(new UpdateBill($bill, $request));
switch ($init_status) { switch ($init_status) {
case 'received': case 'received':
@ -183,3 +270,5 @@ $factory->afterCreating(Bill::class, function ($bill, $faker) use ($company) {
break; break;
} }
}); });
}
}

View File

@ -1,34 +1,118 @@
<?php <?php
use App\Models\Auth\User; namespace Database\Factories;
use App\Models\Setting\Category;
use Faker\Generator as Faker;
$user = User::first(); use App\Abstracts\Factory;
$company = $user->companies()->first(); use App\Models\Setting\Category as Model;
$factory->define(Category::class, function (Faker $faker) use ($company) { class Category extends Factory
setting()->setExtraColumns(['company_id' => $company->id]); {
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$types = ['income', 'expense', 'item', 'other']; $types = ['income', 'expense', 'item', 'other'];
return [ return [
'company_id' => $company->id, 'company_id' => $this->company->id,
'name' => $faker->text(15), 'name' => $this->faker->text(15),
'type' => $faker->randomElement($types), 'type' => $this->faker->randomElement($types),
'color' => $faker->hexColor, 'color' => $this->faker->hexColor,
'enabled' => $faker->boolean ? 1 : 0, 'enabled' => $this->faker->boolean ? 1 : 0,
];
}
/**
* Indicate that the model is enabled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function enabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 1,
]; ];
}); });
}
$factory->state(Category::class, 'enabled', ['enabled' => 1]); /**
* Indicate that the model is disabled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function disabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 0,
];
});
}
$factory->state(Category::class, 'disabled', ['enabled' => 0]); /**
* Indicate that the model type is income.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function income()
{
return $this->state(function (array $attributes) {
return [
'type' => 'income',
];
});
}
$factory->state(Category::class, 'income', ['type' => 'income']); /**
* Indicate that the model type is expense.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function expense()
{
return $this->state(function (array $attributes) {
return [
'type' => 'expense',
];
});
}
$factory->state(Category::class, 'expense', ['type' => 'expense']); /**
* Indicate that the model type is item.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function item()
{
return $this->state(function (array $attributes) {
return [
'type' => 'item',
];
});
}
$factory->state(Category::class, 'item', ['type' => 'item']); /**
* Indicate that the model type is other.
$factory->state(Category::class, 'other', ['type' => 'other']); *
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function other()
{
return $this->state(function (array $attributes) {
return [
'type' => 'other',
];
});
}
}

View File

@ -1,38 +1,100 @@
<?php <?php
use App\Models\Auth\User; namespace Database\Factories;
use App\Models\Common\Contact;
use Faker\Generator as Faker;
$user = User::first(); use App\Abstracts\Factory;
$company = $user->companies()->first(); use App\Models\Common\Contact as Model;
use App\Traits\Contacts;
$factory->define(Contact::class, function (Faker $faker) use ($company) { class Contact extends Factory
session(['company_id' => $company->id]); {
setting()->setExtraColumns(['company_id' => $company->id]); use Contacts;
$types = ['customer', 'vendor']; /**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$types = array_merge($this->getCustomerTypes(), $this->getVendorTypes());
return [ return [
'company_id' => $company->id, 'company_id' => $this->company->id,
'type' => $faker->randomElement($types), 'type' => $this->faker->randomElement($types),
'name' => $faker->name, 'name' => $this->faker->name,
'email' => $faker->unique()->safeEmail, 'email' => $this->faker->unique()->safeEmail,
'user_id' => null, 'user_id' => null,
'tax_number' => $faker->randomNumber(9), 'tax_number' => $this->faker->randomNumber(9),
'phone' => $faker->phoneNumber, 'phone' => $this->faker->phoneNumber,
'address' => $faker->address, 'address' => $this->faker->address,
'website' => 'https://akaunting.com', 'website' => 'https://akaunting.com',
'currency_code' => setting('default.currency'), 'currency_code' => setting('default.currency'),
'reference' => $faker->text(5), 'reference' => $this->faker->text(5),
'enabled' => $faker->boolean ? 1 : 0, 'enabled' => $this->faker->boolean ? 1 : 0,
];
}
/**
* Indicate that the model is enabled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function enabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 1,
]; ];
}); });
}
$factory->state(Contact::class, 'enabled', ['enabled' => 1]); /**
* Indicate that the model is disabled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function disabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 0,
];
});
}
$factory->state(Contact::class, 'disabled', ['enabled' => 0]); /**
* Indicate that the model type is customer.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function customer()
{
return $this->state(function (array $attributes) {
return [
'type' => 'customer',
];
});
}
$factory->state(Contact::class, 'customer', ['type' => 'customer']); /**
* Indicate that the model type is vendor.
$factory->state(Contact::class, 'vendor', ['type' => 'vendor']); *
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function vendor()
{
return $this->state(function (array $attributes) {
return [
'type' => 'vendor',
];
});
}
}

View File

@ -1,23 +1,33 @@
<?php <?php
use App\Models\Auth\User; namespace Database\Factories;
use App\Models\Setting\Currency;
use Faker\Generator as Faker;
$user = User::first(); use App\Abstracts\Factory;
$company = $user->companies()->first(); use App\Models\Setting\Currency as Model;
$factory->define(Currency::class, function (Faker $faker) use ($company) { class Currency extends Factory
session(['company_id' => $company->id]); {
setting()->setExtraColumns(['company_id' => $company->id]); /**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$currencies = config('money'); $currencies = config('money');
Currency::pluck('code')->each(function ($db_code) use (&$currencies) { Model::pluck('code')->each(function ($db_code) use (&$currencies) {
unset($currencies[$db_code]); unset($currencies[$db_code]);
}); });
$random = $faker->randomElement($currencies); $random = $this->faker->randomElement($currencies);
$filtered = array_filter($currencies, function ($value) use ($random) { $filtered = array_filter($currencies, function ($value) use ($random) {
return ($value['code'] == $random['code']); return ($value['code'] == $random['code']);
@ -27,19 +37,44 @@ $factory->define(Currency::class, function (Faker $faker) use ($company) {
$currency = $filtered[$code]; $currency = $filtered[$code];
return [ return [
'company_id' => $company->id, 'company_id' => $this->company->id,
'name' => $currency['name'], 'name' => $currency['name'],
'code' => $code, 'code' => $code,
'rate' => $faker->randomFloat($currency['precision'], 1, 10), 'rate' => $this->faker->randomFloat($currency['precision'], 1, 10),
'precision' => $currency['precision'], 'precision' => $currency['precision'],
'symbol' => $currency['symbol'], 'symbol' => $currency['symbol'],
'symbol_first' => $currency['symbol_first'], 'symbol_first' => $currency['symbol_first'],
'decimal_mark' => $currency['decimal_mark'], 'decimal_mark' => $currency['decimal_mark'],
'thousands_separator' => $currency['thousands_separator'], 'thousands_separator' => $currency['thousands_separator'],
'enabled' => $faker->boolean ? 1 : 0, 'enabled' => $this->faker->boolean ? 1 : 0,
];
}
/**
* Indicate that the model is enabled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function enabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 1,
]; ];
}); });
}
$factory->state(Currency::class, 'enabled', ['enabled' => 1]); /**
* Indicate that the model is disabled.
$factory->state(Currency::class, 'disabled', ['enabled' => 0]); *
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function disabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 0,
];
});
}
}

View File

@ -1,32 +1,84 @@
<?php <?php
use App\Models\Auth\User; namespace Database\Factories;
use App\Models\Common\Dashboard;
use Faker\Generator as Faker;
$user = User::first(); use App\Abstracts\Factory;
$company = $user->companies()->first(); use App\Models\Common\Dashboard as Model;
$factory->define(Dashboard::class, function (Faker $faker) use ($company) { class Dashboard extends Factory
setting()->setExtraColumns(['company_id' => $company->id]); {
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [ return [
'company_id' => $company->id, 'company_id' => $this->company->id,
'name' => $faker->text(15), 'name' => $this->faker->text(15),
'enabled' => $faker->boolean ? 1 : 0, 'enabled' => $this->faker->boolean ? 1 : 0,
];
}
/**
* Indicate that the model is enabled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function enabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 1,
]; ];
}); });
}
$factory->state(Dashboard::class, 'enabled', ['enabled' => 1]); /**
* Indicate that the model is disabled.
$factory->state(Dashboard::class, 'disabled', ['enabled' => 0]); *
* @return \Illuminate\Database\Eloquent\Factories\Factory
$factory->state(Dashboard::class, 'users', function (Faker $faker) use ($company) { */
public function disabled()
{
return $this->state(function (array $attributes) {
return [ return [
'users' => $company->users()->enabled()->get()->pluck('id')->toArray(), 'enabled' => 0,
]; ];
}); });
}
$factory->afterCreating(Dashboard::class, function ($dashboard, $faker) use ($company) { /**
$dashboard->users()->attach($company->users()->enabled()->get()->pluck('id')->toArray()); * Indicate the model users.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function users()
{
return $this->state(function (array $attributes) {
return [
'users' => $this->getCompanyUsers(),
];
}); });
}
/**
* Configure the model factory.
*
* @return $this
*/
public function configure()
{
return $this->afterCreating(function (Model $dashboard) {
$dashboard->users()->attach($this->getCompanyUsers());
});
}
}

View File

@ -1,27 +1,37 @@
<?php <?php
namespace Database\Factories;
use App\Abstracts\Factory;
use App\Events\Sale\InvoiceCancelled; use App\Events\Sale\InvoiceCancelled;
use App\Events\Sale\InvoiceCreated; use App\Events\Sale\InvoiceCreated;
use App\Events\Sale\InvoiceSent; use App\Events\Sale\InvoiceSent;
use App\Events\Sale\InvoiceViewed; use App\Events\Sale\InvoiceViewed;
use App\Events\Sale\PaymentReceived; use App\Events\Sale\PaymentReceived;
use App\Jobs\Sale\UpdateInvoice; use App\Jobs\Sale\UpdateInvoice;
use App\Models\Auth\User;
use App\Models\Common\Contact; use App\Models\Common\Contact;
use App\Models\Common\Item; use App\Models\Common\Item;
use App\Models\Sale\Invoice; use App\Models\Sale\Invoice as Model;
use App\Models\Setting\Tax; use App\Models\Setting\Tax;
use App\Utilities\Date; use App\Utilities\Date;
use Faker\Generator as Faker;
$user = User::first(); class Invoice extends Factory
$company = $user->companies()->first(); {
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
$factory->define(Invoice::class, function (Faker $faker) use ($company) { /**
session(['company_id' => $company->id]); * Define the model's default state.
setting()->setExtraColumns(['company_id' => $company->id]); *
* @return array
$invoiced_at = $faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d H:i:s'); */
public function definition()
{
$invoiced_at = $this->faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d H:i:s');
$due_at = Date::parse($invoiced_at)->addDays(setting('invoice.payment_terms'))->format('Y-m-d H:i:s'); $due_at = Date::parse($invoiced_at)->addDays(setting('invoice.payment_terms'))->format('Y-m-d H:i:s');
$contacts = Contact::customer()->enabled()->get(); $contacts = Contact::customer()->enabled()->get();
@ -29,66 +39,150 @@ $factory->define(Invoice::class, function (Faker $faker) use ($company) {
if ($contacts->count()) { if ($contacts->count()) {
$contact = $contacts->random(1)->first(); $contact = $contacts->random(1)->first();
} else { } else {
$contact = factory(Contact::class)->states('enabled', 'customer')->create(); $contact = Contact::factory()->customer()->enabled()->create();
} }
$statuses = ['draft', 'sent', 'viewed', 'partial', 'paid', 'cancelled']; $statuses = ['draft', 'sent', 'viewed', 'partial', 'paid', 'cancelled'];
return [ return [
'company_id' => $company->id, 'company_id' => $this->company->id,
'invoiced_at' => $invoiced_at, 'invoiced_at' => $invoiced_at,
'due_at' => $due_at, 'due_at' => $due_at,
'invoice_number' => setting('invoice.number_prefix') . $faker->randomNumber(setting('invoice.number_digit')), 'invoice_number' => setting('invoice.number_prefix') . $this->faker->randomNumber(setting('invoice.number_digit')),
'currency_code' => setting('default.currency'), 'currency_code' => setting('default.currency'),
'currency_rate' => '1', 'currency_rate' => '1',
'notes' => $faker->text(5), 'notes' => $this->faker->text(5),
'category_id' => $company->categories()->income()->get()->random(1)->pluck('id')->first(), 'category_id' => $this->company->categories()->income()->get()->random(1)->pluck('id')->first(),
'contact_id' => $contact->id, 'contact_id' => $contact->id,
'contact_name' => $contact->name, 'contact_name' => $contact->name,
'contact_email' => $contact->email, 'contact_email' => $contact->email,
'contact_tax_number' => $contact->tax_number, 'contact_tax_number' => $contact->tax_number,
'contact_phone' => $contact->phone, 'contact_phone' => $contact->phone,
'contact_address' => $contact->address, 'contact_address' => $contact->address,
'status' => $faker->randomElement($statuses), 'status' => $this->faker->randomElement($statuses),
'amount' => '0', 'amount' => '0',
]; ];
}
/**
* Indicate that the model status is draft.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function draft()
{
return $this->state(function (array $attributes) {
return [
'status' => 'draft',
];
}); });
}
$factory->state(Invoice::class, 'draft', ['status' => 'draft']); /**
* Indicate that the model status is sent.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function sent()
{
return $this->state(function (array $attributes) {
return [
'status' => 'sent',
];
});
}
$factory->state(Invoice::class, 'sent', ['status' => 'sent']); /**
* Indicate that the model status is viewed.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function viewed()
{
return $this->state(function (array $attributes) {
return [
'status' => 'viewed',
];
});
}
$factory->state(Invoice::class, 'viewed', ['status' => 'viewed']); /**
* Indicate that the model status is partial.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function partial()
{
return $this->state(function (array $attributes) {
return [
'status' => 'partial',
];
});
}
$factory->state(Invoice::class, 'partial', ['status' => 'partial']); /**
* Indicate that the model status is paid.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function paid()
{
return $this->state(function (array $attributes) {
return [
'status' => 'paid',
];
});
}
$factory->state(Invoice::class, 'paid', ['status' => 'paid']); /**
* Indicate that the model status is cancelled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function cancelled()
{
return $this->state(function (array $attributes) {
return [
'status' => 'cancelled',
];
});
}
$factory->state(Invoice::class, 'cancelled', ['status' => 'cancelled']); /**
* Indicate that the model is recurring.
$factory->state(Invoice::class, 'recurring', function (Faker $faker) { *
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function recurring()
{
return $this->state(function (array $attributes) {
$frequencies = ['monthly', 'weekly']; $frequencies = ['monthly', 'weekly'];
return [ return [
'recurring_frequency' => 'yes', 'recurring_frequency' => 'yes',
'recurring_interval' => '1', 'recurring_interval' => '1',
'recurring_custom_frequency' => $faker->randomElement($frequencies), 'recurring_custom_frequency' => $this->faker->randomElement($frequencies),
'recurring_count' => '1', 'recurring_count' => '1',
]; ];
}); });
}
$factory->state(Invoice::class, 'items', function (Faker $faker) use ($company) { /**
session(['company_id' => $company->id]); * Indicate that the model has items.
setting()->setExtraColumns(['company_id' => $company->id]); *
* @return \Illuminate\Database\Eloquent\Factories\Factory
$amount = $faker->randomFloat(2, 1, 1000); */
public function items()
{
return $this->state(function (array $attributes) {
$amount = $this->faker->randomFloat(2, 1, 1000);
$taxes = Tax::enabled()->get(); $taxes = Tax::enabled()->get();
if ($taxes->count()) { if ($taxes->count()) {
$tax = $taxes->random(1)->first(); $tax = $taxes->random(1)->first();
} else { } else {
$tax = factory(Tax::class)->states('enabled')->create(); $tax = Tax::factory()->enabled()->create();
} }
$items = Item::enabled()->get(); $items = Item::enabled()->get();
@ -96,7 +190,7 @@ $factory->state(Invoice::class, 'items', function (Faker $faker) use ($company)
if ($items->count()) { if ($items->count()) {
$item = $items->random(1)->first(); $item = $items->random(1)->first();
} else { } else {
$item = factory(Item::class)->states('enabled')->create(); $item = Item::factory()->enabled()->create();
} }
$items = [ $items = [
@ -115,25 +209,30 @@ $factory->state(Invoice::class, 'items', function (Faker $faker) use ($company)
'recurring_frequency' => 'no', 'recurring_frequency' => 'no',
]; ];
}); });
}
$factory->afterCreating(Invoice::class, function ($invoice, $faker) use ($company) { /**
session(['company_id' => $company->id]); * Configure the model factory.
setting()->setExtraColumns(['company_id' => $company->id]); *
* @return $this
*/
public function configure()
{
return $this->afterCreating(function (Model $invoice) {
$init_status = $invoice->status; $init_status = $invoice->status;
$invoice->status = 'draft'; $invoice->status = 'draft';
event(new InvoiceCreated($invoice)); event(new InvoiceCreated($invoice));
$invoice->status = $init_status; $invoice->status = $init_status;
$amount = $faker->randomFloat(2, 1, 1000); $amount = $this->faker->randomFloat(2, 1, 1000);
$taxes = Tax::enabled()->get(); $taxes = Tax::enabled()->get();
if ($taxes->count()) { if ($taxes->count()) {
$tax = $taxes->random(1)->first(); $tax = $taxes->random(1)->first();
} else { } else {
$tax = factory(Tax::class)->states('enabled')->create(); $tax = Tax::factory()->enabled()->create();
} }
$items = Item::enabled()->get(); $items = Item::enabled()->get();
@ -141,7 +240,7 @@ $factory->afterCreating(Invoice::class, function ($invoice, $faker) use ($compan
if ($items->count()) { if ($items->count()) {
$item = $items->random(1)->first(); $item = $items->random(1)->first();
} else { } else {
$item = factory(Item::class)->states('enabled')->create(); $item = Item::factory()->enabled()->create();
} }
$items = [ $items = [
@ -160,7 +259,7 @@ $factory->afterCreating(Invoice::class, function ($invoice, $faker) use ($compan
'recurring_frequency' => 'no', 'recurring_frequency' => 'no',
]; ];
$updated_invoice = dispatch_now(new UpdateInvoice($invoice, $request)); $updated_invoice = $this->dispatch(new UpdateInvoice($invoice, $request));
switch ($init_status) { switch ($init_status) {
case 'sent': case 'sent':
@ -192,3 +291,5 @@ $factory->afterCreating(Invoice::class, function ($invoice, $faker) use ($compan
break; break;
} }
}); });
}
}

View File

@ -1,27 +1,63 @@
<?php <?php
use App\Models\Auth\User; namespace Database\Factories;
use App\Models\Common\Item;
use Faker\Generator as Faker;
$user = User::first(); use App\Abstracts\Factory;
$company = $user->companies()->first(); use App\Models\Common\Item as Model;
$factory->define(Item::class, function (Faker $faker) use ($company) { class Item extends Factory
setting()->setExtraColumns(['company_id' => $company->id]); {
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [ return [
'company_id' => $company->id, 'company_id' => $this->company->id,
'name' => $faker->text(15), 'name' => $this->faker->text(15),
'description' => $faker->text(100), 'description' => $this->faker->text(100),
'purchase_price' => $faker->randomFloat(2, 10, 20), 'purchase_price' => $this->faker->randomFloat(2, 10, 20),
'sale_price' => $faker->randomFloat(2, 10, 20), 'sale_price' => $this->faker->randomFloat(2, 10, 20),
'category_id' => $company->categories()->item()->get()->random(1)->pluck('id')->first(), 'category_id' => $this->company->categories()->item()->get()->random(1)->pluck('id')->first(),
'tax_id' => null, 'tax_id' => null,
'enabled' => $faker->boolean ? 1 : 0, 'enabled' => $this->faker->boolean ? 1 : 0,
];
}
/**
* Indicate that the model is enabled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function enabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 1,
]; ];
}); });
}
$factory->state(Item::class, 'enabled', ['enabled' => 1]); /**
* Indicate that the model is disabled.
$factory->state(Item::class, 'disabled', ['enabled' => 0]); *
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function disabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 0,
];
});
}
}

View File

@ -1,18 +1,36 @@
<?php <?php
use App\Models\Auth\Permission; namespace Database\Factories;
use Faker\Generator as Faker;
$factory->define(Permission::class, function (Faker $faker) { use App\Abstracts\Factory;
use App\Models\Auth\Permission as Model;
class Permission extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$map = ['Create', 'Read', 'Update', 'Delete']; $map = ['Create', 'Read', 'Update', 'Delete'];
$prefix = $faker->randomElement($map); $prefix = $this->faker->randomElement($map);
$word_1 = $faker->word; $word_1 = $this->faker->word;
$word_2 = $faker->word; $word_2 = $this->faker->word;
return [ return [
'name' => strtolower($prefix) . '-' . strtolower($word_1) . '-' . strtolower($word_2), 'name' => strtolower($prefix) . '-' . strtolower($word_1) . '-' . strtolower($word_2),
'display_name' => $prefix . ' ' . $word_1 . ' ' . $word_2, 'display_name' => $prefix . ' ' . $word_1 . ' ' . $word_2,
'description' => $prefix . ' ' . $word_1 . ' ' . $word_2, 'description' => $prefix . ' ' . $word_1 . ' ' . $word_2,
]; ];
}); }
}

View File

@ -1,25 +1,64 @@
<?php <?php
use App\Models\Auth\Permission; namespace Database\Factories;
use App\Models\Auth\Role;
use Faker\Generator as Faker;
$factory->define(Role::class, function (Faker $faker) { use App\Abstracts\Factory;
$name = $faker->word; use App\Models\Auth\Permission;
use App\Models\Auth\Role as Model;
class Role extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$name = $this->faker->word;
return [ return [
'name' => strtolower($name), 'name' => strtolower($name),
'display_name' => $name, 'display_name' => $name,
'description' => $name, 'description' => $name,
]; ];
}); }
$factory->state(Role::class, 'permissions', function (Faker $faker) { /**
* Indicate the model permissions.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function permissions()
{
return $this->state(function (array $attributes) {
return [ return [
'permissions' => Permission::take(50)->pluck('id')->toArray(), 'permissions' => $this->getPermissions(),
]; ];
}); });
}
$factory->afterCreating(Role::class, function ($role, $faker) { protected function getPermissions()
$role->permissions()->attach(Permission::take(50)->pluck('id')->toArray()); {
return Permission::take(50)->pluck('id')->toArray();
}
/**
* Configure the model factory.
*
* @return $this
*/
public function configure()
{
return $this->afterCreating(function (Model $role) {
$role->permissions()->attach($this->getPermissions());
}); });
}
}

View File

@ -1,36 +1,132 @@
<?php <?php
use App\Models\Auth\User; namespace Database\Factories;
use App\Models\Setting\Tax;
use Faker\Generator as Faker;
$user = User::first(); use App\Abstracts\Factory;
$company = $user->companies()->first(); use App\Models\Setting\Tax as Model;
$factory->define(Tax::class, function (Faker $faker) use ($company) { class Tax extends Factory
setting()->setExtraColumns(['company_id' => $company->id]); {
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$types = ['normal', 'inclusive', 'compound', 'fixed', 'withholding']; $types = ['normal', 'inclusive', 'compound', 'fixed', 'withholding'];
return [ return [
'company_id' => $company->id, 'company_id' => $this->company->id,
'name' => $faker->text(15), 'name' => $this->faker->text(15),
'rate' => $faker->randomFloat(2, 10, 20), 'rate' => $this->faker->randomFloat(2, 10, 20),
'type' => $faker->randomElement($types), 'type' => $this->faker->randomElement($types),
'enabled' => $faker->boolean ? 1 : 0, 'enabled' => $this->faker->boolean ? 1 : 0,
];
}
/**
* Indicate that the model is enabled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function enabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 1,
]; ];
}); });
}
$factory->state(Tax::class, 'enabled', ['enabled' => 1]); /**
* Indicate that the model is disabled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function disabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 0,
];
});
}
$factory->state(Tax::class, 'disabled', ['enabled' => 0]); /**
* Indicate that the model type is normal.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function normal()
{
return $this->state(function (array $attributes) {
return [
'type' => 'normal',
];
});
}
$factory->state(Tax::class, 'normal', ['type' => 'normal']); /**
* Indicate that the model type is inclusive.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function inclusive()
{
return $this->state(function (array $attributes) {
return [
'type' => 'inclusive',
];
});
}
$factory->state(Tax::class, 'inclusive', ['type' => 'inclusive']); /**
* Indicate that the model type is compound.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function compound()
{
return $this->state(function (array $attributes) {
return [
'type' => 'compound',
];
});
}
$factory->state(Tax::class, 'compound', ['type' => 'compound']); /**
* Indicate that the model type is fixed.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function fixed()
{
return $this->state(function (array $attributes) {
return [
'type' => 'fixed',
];
});
}
$factory->state(Tax::class, 'fixed', ['type' => 'fixed']); /**
* Indicate that the model type is normal.
$factory->state(Tax::class, 'withholding', ['type' => 'withholding']); *
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function withholding()
{
return $this->state(function (array $attributes) {
return [
'type' => 'withholding',
];
});
}
}

View File

@ -1,43 +1,74 @@
<?php <?php
use App\Models\Auth\User; namespace Database\Factories;
use App\Models\Banking\Transaction;
use Faker\Generator as Faker;
$user = User::first(); use App\Abstracts\Factory;
$company = $user->companies()->first(); use App\Models\Banking\Transaction as Model;
use App\Traits\Transactions;
$factory->define(Transaction::class, function (Faker $faker) use ($company) { class Transaction extends Factory
setting()->setExtraColumns(['company_id' => $company->id]); {
use Transactions;
$types = ['income', 'expense']; /**
$type = $faker->randomElement($types); * The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$types = array_merge($this->getIncomeTypes(), $this->getExpenseTypes());
$type = $this->faker->randomElement($types);
return [ return [
'company_id' => $company->id, 'company_id' => $this->company->id,
'type' => $type, 'type' => $type,
'account_id' => setting('default.account'), 'account_id' => setting('default.account'),
'paid_at' => $faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d H:i:s'), 'paid_at' => $this->faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d H:i:s'),
'amount' => $faker->randomFloat(2, 1, 1000), 'amount' => $this->faker->randomFloat(2, 1, 1000),
'currency_code' => setting('default.currency'), 'currency_code' => setting('default.currency'),
'currency_rate' => '1.0', 'currency_rate' => '1.0',
'description' => $faker->text(5), 'description' => $this->faker->text(5),
'category_id' => $company->categories()->type($type)->get()->random(1)->pluck('id')->first(), 'category_id' => $this->company->categories()->type($type)->get()->random(1)->pluck('id')->first(),
'reference' => $faker->text(5), 'reference' => $this->faker->text(5),
'payment_method' => setting('default.payment_method'), 'payment_method' => setting('default.payment_method'),
]; ];
}); }
$factory->state(Transaction::class, 'income', function (Faker $faker) use ($company) { /**
* Indicate that the model type is income.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function income()
{
return $this->state(function (array $attributes) {
return [ return [
'type' => 'income', 'type' => 'income',
'category_id' => $company->categories()->income()->get()->random(1)->pluck('id')->first(), 'category_id' => $this->company->categories()->income()->get()->random(1)->pluck('id')->first(),
]; ];
}); });
}
$factory->state(Transaction::class, 'expense', function (Faker $faker) use ($company) { /**
* Indicate that the model type is expense.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function expense()
{
return $this->state(function (array $attributes) {
return [ return [
'type' => 'expense', 'type' => 'expense',
'category_id' => $company->categories()->expense()->get()->random(1)->pluck('id')->first(), 'category_id' => $this->company->categories()->expense()->get()->random(1)->pluck('id')->first(),
]; ];
}); });
}
}

View File

@ -1,19 +1,29 @@
<?php <?php
use App\Models\Auth\User; namespace Database\Factories;
use App\Abstracts\Factory;
use App\Models\Banking\Account; use App\Models\Banking\Account;
use App\Models\Banking\Transaction; use App\Models\Banking\Transaction;
use App\Models\Banking\Transfer; use App\Models\Banking\Transfer as Model;
use App\Models\Setting\Category; use App\Models\Setting\Category;
use Faker\Generator as Faker;
$user = User::first(); class Transfer extends Factory
$company = $user->companies()->first(); {
/**
$factory->define(Transfer::class, function (Faker $faker) use ($company) { * The name of the factory's corresponding model.
session(['company_id' => $company->id]); *
setting()->setExtraColumns(['company_id' => $company->id]); * @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$accounts = Account::enabled()->get(); $accounts = Account::enabled()->get();
if ($accounts->count() >= 2) { if ($accounts->count() >= 2) {
@ -24,30 +34,31 @@ $factory->define(Transfer::class, function (Faker $faker) use ($company) {
} else { } else {
$expense_account = $accounts->first(); $expense_account = $accounts->first();
$income_account = factory(Account::class)->states('enabled', 'default_currency')->create(); $income_account = Account::factory()->enabled()->default_currency()->create();
} }
$request = [ $request = [
'amount' => $faker->randomFloat(2, 1, 1000), 'amount' => $this->faker->randomFloat(2, 1, 1000),
'paid_at' => $faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d'), 'paid_at' => $this->faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d'),
'category_id' => Category::transfer(), 'category_id' => Category::transfer(),
'description' => $faker->text(20), 'description' => $this->faker->text(20),
'reference' => $faker->text(20), 'reference' => $this->faker->text(20),
]; ];
$expense_transaction = factory(Transaction::class)->create(array_merge($request, [ $expense_transaction = Transaction::factory()->create(array_merge($request, [
'type' => 'expense', 'type' => 'expense',
'account_id' => $expense_account->id, 'account_id' => $expense_account->id,
])); ]));
$income_transaction = factory(Transaction::class)->create(array_merge($request, [ $income_transaction = Transaction::factory()->create(array_merge($request, [
'type' => 'income', 'type' => 'income',
'account_id' => $income_account->id, 'account_id' => $income_account->id,
])); ]));
return [ return [
'company_id' => $company->id, 'company_id' => $this->company->id,
'expense_transaction_id' => $expense_transaction->id, 'expense_transaction_id' => $expense_transaction->id,
'income_transaction_id' => $income_transaction->id, 'income_transaction_id' => $income_transaction->id,
]; ];
}); }
}

View File

@ -1,15 +1,32 @@
<?php <?php
use App\Models\Auth\User; namespace Database\Factories;
use Faker\Generator as Faker;
use App\Abstracts\Factory;
use App\Models\Auth\User as Model;
use Illuminate\Support\Str; use Illuminate\Support\Str;
$factory->define(User::class, function (Faker $faker) { class User extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Model::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$password = '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'; // password $password = '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'; // password
return [ return [
'name' => $faker->name, 'name' => $this->faker->name,
'email' => $faker->unique()->safeEmail, 'email' => $this->faker->unique()->safeEmail,
'password' => $password, 'password' => $password,
'password_confirmation' => $password, 'password_confirmation' => $password,
'remember_token' => Str::random(10), 'remember_token' => Str::random(10),
@ -18,8 +35,33 @@ $factory->define(User::class, function (Faker $faker) {
'roles' => ['1'], 'roles' => ['1'],
'enabled' => $this->faker->boolean ? 1 : 0, 'enabled' => $this->faker->boolean ? 1 : 0,
]; ];
}
/**
* Indicate that the model is enabled.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function enabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 1,
];
}); });
}
$factory->state(User::class, 'enabled', ['enabled' => 1]); /**
* Indicate that the model is disabled.
$factory->state(User::class, 'disabled', ['enabled' => 0]); *
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function disabled()
{
return $this->state(function (array $attributes) {
return [
'enabled' => 0,
];
});
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CoreV210 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('failed_jobs', function (Blueprint $table) {
$table->string('uuid')->after('id')->nullable()->unique();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -35,25 +35,25 @@ class SampleData extends Seeder
$bar->start(); $bar->start();
factory(Contact::class, $count)->create(); Contact::factory()->count($count)->create();
$bar->advance(); $bar->advance();
factory(Category::class, $count)->create(); Category::factory()->count($count)->create();
$bar->advance(); $bar->advance();
factory(Tax::class, $small_count)->states('enabled')->create(); Tax::factory()->count($small_count)->enabled()->create();
$bar->advance(); $bar->advance();
factory(Item::class, $count)->create(); Item::factory()->count($count)->create();
$bar->advance(); $bar->advance();
factory(Account::class, $small_count)->create(); Account::factory()->count($small_count)->create();
$bar->advance(); $bar->advance();
factory(Bill::class, $count)->create(); Bill::factory()->count($count)->create();
$bar->advance(); $bar->advance();
factory(Invoice::class, $count)->create(); Invoice::factory()->count($count)->create();
$bar->advance(); $bar->advance();
$bar->finish(); $bar->finish();

View File

@ -13,11 +13,11 @@
<directory suffix="Test.php">./modules/**/Tests/Feature</directory> <directory suffix="Test.php">./modules/**/Tests/Feature</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
<filter> <coverage processUncoveredFiles="true">
<whitelist processUncoveredFilesFromWhitelist="true"> <include>
<directory suffix=".php">./app</directory> <directory suffix=".php">./app</directory>
</whitelist> </include>
</filter> </coverage>
<php> <php>
<server name="APP_ENV" value="testing"/> <server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/> <server name="BCRYPT_ROUNDS" value="4"/>

View File

@ -26,13 +26,13 @@
</div> </div>
</div> </div>
@permission('update-auth-permissions') @can('update-auth-permissions')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('permissions.index') }} {{ Form::saveButtons('permissions.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
@endsection @endsection

View File

@ -2,11 +2,11 @@
@section('title', trans_choice('general.permissions', 2)) @section('title', trans_choice('general.permissions', 2))
@permission('create-auth-permissions') @can('create-auth-permissions')
@section('new_button') @section('new_button')
<a href="{{ route('permissions.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('permissions.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
@endsection @endsection
@endpermission @endcan
@section('content') @section('content')
<div class="card"> <div class="card">
@ -54,10 +54,10 @@
</a> </a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('permissions.edit', $item->id) }}">{{ trans('general.edit') }}</a> <a class="dropdown-item" href="{{ route('permissions.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@permission('delete-auth-permissions') @can('delete-auth-permissions')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($item, 'permissions.destroy') !!} {!! Form::deleteLink($item, 'permissions.destroy') !!}
@endpermission @endcan
</div> </div>
</div> </div>
</td> </td>

View File

@ -79,13 +79,13 @@
</div> </div>
</div> </div>
@permission('update-auth-roles') @can('update-auth-roles')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('roles.index') }} {{ Form::saveButtons('roles.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
</div> </div>
</div> </div>
{!! Form::close() !!} {!! Form::close() !!}

View File

@ -2,11 +2,11 @@
@section('title', trans_choice('general.roles', 2)) @section('title', trans_choice('general.roles', 2))
@permission('create-auth-roles') @can('create-auth-roles')
@section('new_button') @section('new_button')
<a href="{{ route('roles.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('roles.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
@endsection @endsection
@endpermission @endcan
@section('content') @section('content')
<div class="card"> <div class="card">
@ -54,10 +54,10 @@
</a> </a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('roles.edit', $item->id) }}">{{ trans('general.edit') }}</a> <a class="dropdown-item" href="{{ route('roles.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@permission('delete-auth-roles') @can('delete-auth-roles')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($item, 'roles.destroy') !!} {!! Form::deleteLink($item, 'roles.destroy') !!}
@endpermission @endcan
</div> </div>
</div> </div>
</td> </td>

View File

@ -47,13 +47,13 @@
{{ Form::fileGroup('picture', trans_choice('general.pictures', 1)) }} {{ Form::fileGroup('picture', trans_choice('general.pictures', 1)) }}
@endif @endif
@permission('read-common-companies') @can('read-common-companies')
{{ Form::multiSelectRemoteGroup('companies', trans_choice('general.companies', 2), 'user', $companies, [], ['required' => 'required', 'remote_action' => route('companies.autocomplete'), 'remote_type' => 'company']) }} {{ Form::multiSelectRemoteGroup('companies', trans_choice('general.companies', 2), 'user', $companies, [], ['required' => 'required', 'remote_action' => route('companies.autocomplete'), 'remote_type' => 'company']) }}
@endpermission @endcan
@permission('read-auth-roles') @can('read-auth-roles')
{{ Form::checkboxGroup('roles', trans_choice('general.roles', 2), $roles, 'display_name') }} {{ Form::checkboxGroup('roles', trans_choice('general.roles', 2), $roles, 'display_name') }}
@endpermission @endcan
{{ Form::radioGroup('enabled', trans('general.enabled'), true) }} {{ Form::radioGroup('enabled', trans('general.enabled'), true) }}
</div> </div>

View File

@ -48,25 +48,25 @@
{{ Form::fileGroup('picture', trans_choice('general.pictures', 1)) }} {{ Form::fileGroup('picture', trans_choice('general.pictures', 1)) }}
@endif @endif
@permission('read-common-companies') @can('read-common-companies')
{{ Form::multiSelectRemoteGroup('companies', trans_choice('general.companies', 2), 'user', $companies, $user->company_ids, ['required' => 'required', 'disabled' => (in_array('customer', $user->roles()->pluck('name')->toArray())) ? 'true' : 'false', 'remote_action' => route('companies.autocomplete'), 'remote_type' => 'company']) }} {{ Form::multiSelectRemoteGroup('companies', trans_choice('general.companies', 2), 'user', $companies, $user->company_ids, ['required' => 'required', 'disabled' => (in_array('customer', $user->roles()->pluck('name')->toArray())) ? 'true' : 'false', 'remote_action' => route('companies.autocomplete'), 'remote_type' => 'company']) }}
@endpermission @endcan
@permission('read-auth-roles') @can('read-auth-roles')
{{ Form::checkboxGroup('roles', trans_choice('general.roles', 2), $roles, 'display_name') }} {{ Form::checkboxGroup('roles', trans_choice('general.roles', 2), $roles, 'display_name') }}
@endpermission @endcan
{{ Form::radioGroup('enabled', trans('general.enabled'), $user->enabled) }} {{ Form::radioGroup('enabled', trans('general.enabled'), $user->enabled) }}
</div> </div>
</div> </div>
@permission(['update-auth-users', 'update-auth-profile']) @canany(['update-auth-users', 'update-auth-profile'])
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('users.index') }} {{ Form::saveButtons('users.index') }}
</div> </div>
</div> </div>
@endpermission @endcanany
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
@endsection @endsection

View File

@ -2,11 +2,11 @@
@section('title', trans_choice('general.users', 2)) @section('title', trans_choice('general.users', 2))
@permission('create-auth-users') @can('create-auth-users')
@section('new_button') @section('new_button')
<a href="{{ route('users.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('users.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
@endsection @endsection
@endpermission @endcan
@section('content') @section('content')
<div class="card"> <div class="card">
@ -88,10 +88,10 @@
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('users.edit', $item->id) }}">{{ trans('general.edit') }}</a> <a class="dropdown-item" href="{{ route('users.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@if (user()->id != $item->id) @if (user()->id != $item->id)
@permission('delete-auth-users') @can('delete-auth-users')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($item, 'users.destroy') !!} {!! Form::deleteLink($item, 'users.destroy') !!}
@endpermission @endcan
@endif @endif
</div> </div>
</div> </div>

View File

@ -38,13 +38,13 @@
</div> </div>
</div> </div>
@permission('update-banking-accounts') @can('update-banking-accounts')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('accounts.index') }} {{ Form::saveButtons('accounts.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
@endsection @endsection

View File

@ -3,9 +3,9 @@
@section('title', trans_choice('general.accounts', 2)) @section('title', trans_choice('general.accounts', 2))
@section('new_button') @section('new_button')
@permission('create-banking-accounts') @can('create-banking-accounts')
<a href="{{ route('accounts.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('accounts.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
@endpermission @endcan
@endsection @endsection
@section('content') @section('content')
@ -68,10 +68,10 @@
</a> </a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('accounts.edit', $item->id) }}">{{ trans('general.edit') }}</a> <a class="dropdown-item" href="{{ route('accounts.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@permission('delete-banking-accounts') @can('delete-banking-accounts')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($item, 'accounts.destroy') !!} {!! Form::deleteLink($item, 'accounts.destroy') !!}
@endpermission @endcan
</div> </div>
</div> </div>
</td> </td>

View File

@ -107,7 +107,7 @@
@endif @endif
</div> </div>
@permission('update-banking-reconciliations') @can('update-banking-reconciliations')
<div class="card-footer"> <div class="card-footer">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@ -131,7 +131,7 @@
</div> </div>
</div> </div>
</div> </div>
@endpermission @endcan
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>

View File

@ -3,9 +3,9 @@
@section('title', trans_choice('general.reconciliations', 2)) @section('title', trans_choice('general.reconciliations', 2))
@section('new_button') @section('new_button')
@permission('create-banking-reconciliations') @can('create-banking-reconciliations')
<a href="{{ route('reconciliations.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('reconciliations.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
@endpermission @endcan
@endsection @endsection
@section('content') @section('content')
@ -65,10 +65,10 @@
</a> </a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('reconciliations.edit', $item->id) }}">{{ trans('general.edit') }}</a> <a class="dropdown-item" href="{{ route('reconciliations.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@permission('delete-banking-reconciliations') @can('delete-banking-reconciliations')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($item, 'reconciliations.destroy') !!} {!! Form::deleteLink($item, 'reconciliations.destroy') !!}
@endpermission @endcan
</div> </div>
</div> </div>
</td> </td>

View File

@ -3,12 +3,12 @@
@section('title', trans_choice('general.transactions', 2)) @section('title', trans_choice('general.transactions', 2))
@section('new_button') @section('new_button')
@permission('create-sales-revenues') @can('create-sales-revenues')
<a href="{{ route('revenues.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_income') }}</a> <a href="{{ route('revenues.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_income') }}</a>
@endpermission @endcan
@permission('create-purchases-payments') @can('create-purchases-payments')
<a href="{{ route('payments.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_expense') }}</a> <a href="{{ route('payments.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_expense') }}</a>
@endpermission @endcan
<a href="{{ route('import.create', ['banking', 'transactions']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a> <a href="{{ route('import.create', ['banking', 'transactions']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a>
<a href="{{ route('transactions.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a> <a href="{{ route('transactions.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a>
@endsection @endsection

View File

@ -37,13 +37,13 @@
</div> </div>
</div> </div>
@permission('update-banking-transfers') @can('update-banking-transfers')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('transfers.index') }} {{ Form::saveButtons('transfers.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
@endsection @endsection

View File

@ -3,9 +3,9 @@
@section('title', trans_choice('general.transfers', 2)) @section('title', trans_choice('general.transfers', 2))
@section('new_button') @section('new_button')
@permission('create-banking-transfers') @can('create-banking-transfers')
<a href="{{ route('transfers.create') }}" class="btn btn-success btn-sm header-button-top"><span class="fa fa-plus"></span> &nbsp;{{ trans('general.add_new') }}</a> <a href="{{ route('transfers.create') }}" class="btn btn-success btn-sm header-button-top"><span class="fa fa-plus"></span> &nbsp;{{ trans('general.add_new') }}</a>
@endpermission @endcan
<span><a href="{{ route('import.create', ['banking', 'transfers']) }}" class="btn btn-white btn-sm header-button-top"><span class="fa fa-upload "></span> &nbsp;{{ trans('import.import') }}</a></span> <span><a href="{{ route('import.create', ['banking', 'transfers']) }}" class="btn btn-white btn-sm header-button-top"><span class="fa fa-upload "></span> &nbsp;{{ trans('import.import') }}</a></span>
<span><a href="{{ route('transfers.export', request()->input()) }}" class="btn btn-white btn-sm header-button-top"><span class="fa fa-download"></span> &nbsp;{{ trans('general.export') }}</a></span> <span><a href="{{ route('transfers.export', request()->input()) }}" class="btn btn-white btn-sm header-button-top"><span class="fa fa-download"></span> &nbsp;{{ trans('general.export') }}</a></span>
@endsection @endsection
@ -59,10 +59,10 @@
</a> </a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('transfers.edit', $item->id) }}">{{ trans('general.edit') }}</a> <a class="dropdown-item" href="{{ route('transfers.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@permission('delete-banking-transfers') @can('delete-banking-transfers')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($item, 'transfers.destroy') !!} {!! Form::deleteLink($item, 'transfers.destroy') !!}
@endpermission @endcan
</div> </div>
</div> </div>
</td> </td>

View File

@ -34,13 +34,13 @@
</div> </div>
</div> </div>
@permission('update-common-companies') @can('update-common-companies')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('companies.index') }} {{ Form::saveButtons('companies.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
@endsection @endsection

View File

@ -2,11 +2,11 @@
@section('title', trans_choice('general.companies', 2)) @section('title', trans_choice('general.companies', 2))
@permission('create-common-companies') @can('create-common-companies')
@section('new_button') @section('new_button')
<a href="{{ route('companies.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('companies.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
@endsection @endsection
@endpermission @endcan
@section('content') @section('content')
<div class="card"> <div class="card">
@ -78,10 +78,10 @@
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@endif @endif
<a class="dropdown-item" href="{{ route('companies.edit', $item->id) }}">{{ trans('general.edit') }}</a> <a class="dropdown-item" href="{{ route('companies.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@permission('delete-common-companies') @can('delete-common-companies')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($item, 'companies.destroy') !!} {!! Form::deleteLink($item, 'companies.destroy') !!}
@endpermission @endcan
</div> </div>
</div> </div>
</td> </td>

View File

@ -19,9 +19,9 @@
<div class="row"> <div class="row">
{{ Form::textGroup('name', trans('general.name'), 'font') }} {{ Form::textGroup('name', trans('general.name'), 'font') }}
@permission('read-auth-users') @can('read-auth-users')
{{ Form::checkboxGroup('users', trans_choice('general.users', 2), $users, 'name') }} {{ Form::checkboxGroup('users', trans_choice('general.users', 2), $users, 'name') }}
@endpermission @endcan
{{ Form::radioGroup('enabled', trans('general.enabled'), true) }} {{ Form::radioGroup('enabled', trans('general.enabled'), true) }}
</div> </div>

View File

@ -20,21 +20,21 @@
<div class="row"> <div class="row">
{{ Form::textGroup('name', trans('general.name'), 'font') }} {{ Form::textGroup('name', trans('general.name'), 'font') }}
@permission('read-auth-users') @can('read-auth-users')
{{ Form::checkboxGroup('users', trans_choice('general.users', 2), $users, 'name') }} {{ Form::checkboxGroup('users', trans_choice('general.users', 2), $users, 'name') }}
@endpermission @endcan
{{ Form::radioGroup('enabled', trans('general.enabled'), $dashboard->enabled) }} {{ Form::radioGroup('enabled', trans('general.enabled'), $dashboard->enabled) }}
</div> </div>
</div> </div>
@permission('update-common-dashboards') @can('update-common-dashboards')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('dashboards.index') }} {{ Form::saveButtons('dashboards.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
@endsection @endsection

View File

@ -2,11 +2,11 @@
@section('title', trans_choice('general.dashboards', 2)) @section('title', trans_choice('general.dashboards', 2))
@permission('create-common-dashboards') @can('create-common-dashboards')
@section('new_button') @section('new_button')
<a href="{{ route('dashboards.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('dashboards.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
@endsection @endsection
@endpermission @endcan
@section('content') @section('content')
<div class="card"> <div class="card">
@ -68,10 +68,10 @@
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@endif @endif
<a class="dropdown-item" href="{{ route('dashboards.edit', $item->id) }}">{{ trans('general.edit') }}</a> <a class="dropdown-item" href="{{ route('dashboards.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@permission('delete-common-dashboards') @can('delete-common-dashboards')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($item, 'dashboards.destroy') !!} {!! Form::deleteLink($item, 'dashboards.destroy') !!}
@endpermission @endcan
</div> </div>
</div> </div>
</td> </td>

View File

@ -3,7 +3,7 @@
@section('title', $dashboard->name) @section('title', $dashboard->name)
@section('dashboard_action') @section('dashboard_action')
@permission(['create-common-widgets', 'read-common-dashboards']) @canany(['create-common-widgets', 'read-common-dashboards'])
<span class="dashboard-action"> <span class="dashboard-action">
<div class="dropdown"> <div class="dropdown">
<a class="btn btn-sm items-align-center py-2 mt--1" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a class="btn btn-sm items-align-center py-2 mt--1" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -11,25 +11,25 @@
</a> </a>
<div class="dropdown-menu dropdown-menu-sm-right dropdown-menu-xs-right dropdown-menu-arrow"> <div class="dropdown-menu dropdown-menu-sm-right dropdown-menu-xs-right dropdown-menu-arrow">
@permission('create-common-widgets') @can('create-common-widgets')
{!! Form::button(trans('general.title.add', ['type' => trans_choice('general.widgets', 1)]), [ {!! Form::button(trans('general.title.add', ['type' => trans_choice('general.widgets', 1)]), [
'type' => 'button', 'type' => 'button',
'class' => 'dropdown-item', 'class' => 'dropdown-item',
'title' => trans('general.title.add', ['type' => trans_choice('general.widgets', 1)]), 'title' => trans('general.title.add', ['type' => trans_choice('general.widgets', 1)]),
'@click' => 'onCreateWidget()', '@click' => 'onCreateWidget()',
]) !!} ]) !!}
@endpermission @endcan
@permission('update-common-dashboards') @can('update-common-dashboards')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@permission('create-common-dashboards') @can('create-common-dashboards')
<a class="dropdown-item" href="{{ route('dashboards.create') }}">{{ trans('general.title.create', ['type' => trans_choice('general.dashboards', 1)]) }}</a> <a class="dropdown-item" href="{{ route('dashboards.create') }}">{{ trans('general.title.create', ['type' => trans_choice('general.dashboards', 1)]) }}</a>
@endpermission @endcan
<a class="dropdown-item" href="{{ route('dashboards.index') }}">{{ trans('general.title.manage', ['type' => trans_choice('general.dashboards', 2)]) }}</a> <a class="dropdown-item" href="{{ route('dashboards.index') }}">{{ trans('general.title.manage', ['type' => trans_choice('general.dashboards', 2)]) }}</a>
@endpermission @endcan
</div> </div>
</div> </div>
</span> </span>
@endpermission @endcanany
@php @php
$text = json_encode([ $text = json_encode([

View File

@ -36,13 +36,13 @@
</div> </div>
</div> </div>
@permission('update-common-items') @can('update-common-items')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('items.index') }} {{ Form::saveButtons('items.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>

View File

@ -3,10 +3,10 @@
@section('title', trans_choice('general.items', 2)) @section('title', trans_choice('general.items', 2))
@section('new_button') @section('new_button')
@permission('create-common-items') @can('create-common-items')
<a href="{{ route('items.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('items.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
<a href="{{ route('import.create', ['common', 'items']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a> <a href="{{ route('import.create', ['common', 'items']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a>
@endpermission @endcan
<a href="{{ route('items.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a> <a href="{{ route('items.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a>
@endsection @endsection
@ -82,14 +82,14 @@
</a> </a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('items.edit', $item->id) }}">{{ trans('general.edit') }}</a> <a class="dropdown-item" href="{{ route('items.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@permission('create-common-items') @can('create-common-items')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{ route('items.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a> <a class="dropdown-item" href="{{ route('items.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a>
@endpermission @endcan
@permission('delete-common-items') @can('delete-common-items')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($item, 'items.destroy') !!} {!! Form::deleteLink($item, 'items.destroy') !!}
@endpermission @endcan
</div> </div>
</div> </div>
</td> </td>

View File

@ -67,13 +67,13 @@
</div> </div>
</div> </div>
@permission('update-common-reports') @can('update-common-reports')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('reports.index') }} {{ Form::saveButtons('reports.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>

View File

@ -3,9 +3,9 @@
@section('title', trans_choice('general.reports', 2)) @section('title', trans_choice('general.reports', 2))
@section('new_button') @section('new_button')
@permission('create-common-reports') @can('create-common-reports')
<a href="{{ route('reports.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('reports.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
@endpermission @endcan
<a href="{{ route('reports.clear') }}" class="btn btn-warning btn-sm">{{ trans('general.clear_cache') }}</a> <a href="{{ route('reports.clear') }}" class="btn btn-warning btn-sm">{{ trans('general.clear_cache') }}</a>
@endsection @endsection
@ -26,14 +26,14 @@
</a> </a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('reports.edit', $report->id) }}">{{ trans('general.edit') }}</a> <a class="dropdown-item" href="{{ route('reports.edit', $report->id) }}">{{ trans('general.edit') }}</a>
@permission('create-common-reports') @can('create-common-reports')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{ route('reports.duplicate', $report->id) }}">{{ trans('general.duplicate') }}</a> <a class="dropdown-item" href="{{ route('reports.duplicate', $report->id) }}">{{ trans('general.duplicate') }}</a>
@endpermission @endcan
@permission('delete-common-reports') @can('delete-common-reports')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($report, 'common/reports') !!} {!! Form::deleteLink($report, 'common/reports') !!}
@endpermission @endcan
</div> </div>
</div> </div>
</span> </span>

View File

@ -83,7 +83,7 @@
</div> </div>
<div class="card-footer"> <div class="card-footer">
@permission('create-modules-item') @can('create-modules-item')
@if ($module->install) @if ($module->install)
<a href="#" class="btn btn-warning btn-block" disabled="disabled"> <a href="#" class="btn btn-warning btn-block" disabled="disabled">
{{ trans('modules.pre_sale') }} {{ trans('modules.pre_sale') }}
@ -93,7 +93,7 @@
{{ trans('modules.pre_sale') }} {{ trans('modules.pre_sale') }}
</a> </a>
@endif @endif
@endpermission @endcan
@if (!empty($module->purchase_desc)) @if (!empty($module->purchase_desc))
<div class="text-center mt-3"> <div class="text-center mt-3">

View File

@ -219,19 +219,19 @@
<div class="card-footer"> <div class="card-footer">
@if ($installed) @if ($installed)
@permission('delete-modules-item') @can('delete-modules-item')
<a href="{{ route('apps.app.uninstall', $module->slug) }}" class="btn btn-block btn-danger">{{ trans('modules.button.uninstall') }}</a> <a href="{{ route('apps.app.uninstall', $module->slug) }}" class="btn btn-block btn-danger">{{ trans('modules.button.uninstall') }}</a>
@endpermission @endcan
@permission('update-modules-item') @can('update-modules-item')
@if ($enable) @if ($enable)
<a href="{{ route('apps.app.disable', $module->slug) }}" class="btn btn-block btn-warning">{{ trans('modules.button.disable') }}</a> <a href="{{ route('apps.app.disable', $module->slug) }}" class="btn btn-block btn-warning">{{ trans('modules.button.disable') }}</a>
@else @else
<a href="{{ route('apps.app.enable', $module->slug) }}" class="btn btn-block btn-success">{{ trans('modules.button.enable') }}</a> <a href="{{ route('apps.app.enable', $module->slug) }}" class="btn btn-block btn-success">{{ trans('modules.button.enable') }}</a>
@endif @endif
@endpermission @endcan
@else @else
@permission('create-modules-item') @can('create-modules-item')
@if ($module->install) @if ($module->install)
<button type="button" @click="onInstall('{{ $module->action_url }}', '{{ $module->name }}', '{{ $module->version }}')" class="btn btn-success btn-block" id="install-module"> <button type="button" @click="onInstall('{{ $module->action_url }}', '{{ $module->name }}', '{{ $module->version }}')" class="btn btn-success btn-block" id="install-module">
{{ trans('modules.install') }} {{ trans('modules.install') }}
@ -241,7 +241,7 @@
{{ trans('modules.buy_now') }} {{ trans('modules.buy_now') }}
</a> </a>
@endif @endif
@endpermission @endcan
@endif @endif
@if (!empty($module->purchase_desc)) @if (!empty($module->purchase_desc))

View File

@ -9,11 +9,11 @@
<img class="border-radius-none border-0 mr-3" alt="Akaunting" src="{{ asset('public/img/akaunting-logo-white.svg') }}"> <img class="border-radius-none border-0 mr-3" alt="Akaunting" src="{{ asset('public/img/akaunting-logo-white.svg') }}">
</span> </span>
<span class="nav-link-text long-texts pl-2 mwpx-100">{{ Str::limit(setting('company.name'), 22) }}</span> <span class="nav-link-text long-texts pl-2 mwpx-100">{{ Str::limit(setting('company.name'), 22) }}</span>
@permission('read-common-companies') @can('read-common-companies')
<i class="fas fa-sort-down pl-2"></i> <i class="fas fa-sort-down pl-2"></i>
@endpermission @endcan
</a> </a>
@permission('read-common-companies') @can('read-common-companies')
<div class="dropdown-menu dropdown-menu-right menu-dropdown menu-dropdown-width"> <div class="dropdown-menu dropdown-menu-right menu-dropdown menu-dropdown-width">
@foreach($companies as $com) @foreach($companies as $com)
<a href="{{ route('companies.switch', $com->id) }}" class="dropdown-item"> <a href="{{ route('companies.switch', $com->id) }}" class="dropdown-item">
@ -21,15 +21,15 @@
<span>{{ Str::limit($com->name, 18) }}</span> <span>{{ Str::limit($com->name, 18) }}</span>
</a> </a>
@endforeach @endforeach
@permission('update-common-companies') @can('update-common-companies')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a href="{{ route('companies.index') }}" class="dropdown-item"> <a href="{{ route('companies.index') }}" class="dropdown-item">
<i class="fas fa-cogs"></i> <i class="fas fa-cogs"></i>
<span>{{ trans('general.title.manage', ['type' => trans_choice('general.companies', 2)]) }}</span> <span>{{ trans('general.title.manage', ['type' => trans_choice('general.companies', 2)]) }}</span>
</a> </a>
@endpermission @endcan
</div> </div>
@endpermission @endcan
</li> </li>
</ul> </ul>
<div class="ml-auto left-menu-toggle-position overflow-hidden"> <div class="ml-auto left-menu-toggle-position overflow-hidden">

View File

@ -4,7 +4,7 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent"> <div class="collapse navbar-collapse" id="navbarSupportedContent">
@stack('navbar_search') @stack('navbar_search')
@permission('read-common-search') @can('read-common-search')
<form class="navbar-search navbar-search-light form-inline mb-0" id="navbar-search-main" autocomplete="off"> <form class="navbar-search navbar-search-light form-inline mb-0" id="navbar-search-main" autocomplete="off">
<div id="global-search" class="form-group mb-0 mr-sm-3"> <div id="global-search" class="form-group mb-0 mr-sm-3">
<div class="input-group input-group-alternative input-group-merge"> <div class="input-group input-group-alternative input-group-merge">
@ -36,7 +36,7 @@
<span aria-hidden="true">×</span> <span aria-hidden="true">×</span>
</button> </button>
</form> </form>
@endpermission @endcan
<ul class="navbar-nav align-items-center ml-md-auto"> <ul class="navbar-nav align-items-center ml-md-auto">
<li class="nav-item d-xl-none"> <li class="nav-item d-xl-none">
@ -57,7 +57,7 @@
</a> </a>
</li> </li>
@permission(['create-sales-invoices', 'create-sales-revenues', 'create-sales-invoices', 'create-purchases-bills', 'create-purchases-payments', 'create-purchases-vendors']) @canany(['create-sales-invoices', 'create-sales-revenues', 'create-sales-invoices', 'create-purchases-bills', 'create-purchases-payments', 'create-purchases-vendors'])
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a class="nav-link" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-plus"></i> <i class="fas fa-plus"></i>
@ -66,75 +66,75 @@
<div class="row shortcuts px-4"> <div class="row shortcuts px-4">
@stack('navbar_create_invoice') @stack('navbar_create_invoice')
@permission('create-sales-invoices') @can('create-sales-invoices')
<a href="{{ route('invoices.create') }}" class="col-4 shortcut-item"> <a href="{{ route('invoices.create') }}" class="col-4 shortcut-item">
<span class="shortcut-media avatar rounded-circle bg-gradient-info"> <span class="shortcut-media avatar rounded-circle bg-gradient-info">
<i class="fa fa-money-bill"></i> <i class="fa fa-money-bill"></i>
</span> </span>
<small class="text-info">{{ trans_choice('general.invoices', 1) }}</small> <small class="text-info">{{ trans_choice('general.invoices', 1) }}</small>
</a> </a>
@endpermission @endcan
@stack('navbar_create_revenue') @stack('navbar_create_revenue')
@permission('create-sales-revenues') @can('create-sales-revenues')
<a href="{{ route('revenues.create') }}" class="col-4 shortcut-item"> <a href="{{ route('revenues.create') }}" class="col-4 shortcut-item">
<span class="shortcut-media avatar rounded-circle bg-gradient-info"> <span class="shortcut-media avatar rounded-circle bg-gradient-info">
<i class="fas fa-hand-holding-usd"></i> <i class="fas fa-hand-holding-usd"></i>
</span> </span>
<small class="text-info">{{ trans_choice('general.revenues', 1) }}</small> <small class="text-info">{{ trans_choice('general.revenues', 1) }}</small>
</a> </a>
@endpermission @endcan
@stack('navbar_create_customer') @stack('navbar_create_customer')
@permission('create-sales-customers') @can('create-sales-customers')
<a href="{{ route('customers.create') }}" class="col-4 shortcut-item"> <a href="{{ route('customers.create') }}" class="col-4 shortcut-item">
<span class="shortcut-media avatar rounded-circle bg-gradient-info"> <span class="shortcut-media avatar rounded-circle bg-gradient-info">
<i class="fas fa-user"></i> <i class="fas fa-user"></i>
</span> </span>
<small class="text-info">{{ trans_choice('general.customers', 1) }}</small> <small class="text-info">{{ trans_choice('general.customers', 1) }}</small>
</a> </a>
@endpermission @endcan
@stack('navbar_create_bill') @stack('navbar_create_bill')
@permission('create-purchases-bills') @can('create-purchases-bills')
<a href="{{ route('bills.create') }}" class="col-4 shortcut-item"> <a href="{{ route('bills.create') }}" class="col-4 shortcut-item">
<span class="shortcut-media avatar rounded-circle bg-gradient-danger"> <span class="shortcut-media avatar rounded-circle bg-gradient-danger">
<i class="fa fa-shopping-cart"></i> <i class="fa fa-shopping-cart"></i>
</span> </span>
<small class="text-danger">{{ trans_choice('general.bills', 1) }}</small> <small class="text-danger">{{ trans_choice('general.bills', 1) }}</small>
</a> </a>
@endpermission @endcan
@stack('navbar_create_payment') @stack('navbar_create_payment')
@permission('create-purchases-payments') @can('create-purchases-payments')
<a href="{{ route('payments.create') }}" class="col-4 shortcut-item"> <a href="{{ route('payments.create') }}" class="col-4 shortcut-item">
<span class="shortcut-media avatar rounded-circle bg-gradient-danger"> <span class="shortcut-media avatar rounded-circle bg-gradient-danger">
<i class="fas fa-hand-holding-usd"></i> <i class="fas fa-hand-holding-usd"></i>
</span> </span>
<small class="text-danger">{{ trans_choice('general.payments', 1) }}</small> <small class="text-danger">{{ trans_choice('general.payments', 1) }}</small>
</a> </a>
@endpermission @endcan
@stack('navbar_create_vendor_start') @stack('navbar_create_vendor_start')
@permission('create-purchases-vendors') @can('create-purchases-vendors')
<a href="{{ route('vendors.create') }}" class="col-4 shortcut-item"> <a href="{{ route('vendors.create') }}" class="col-4 shortcut-item">
<span class="shortcut-media avatar rounded-circle bg-gradient-danger"> <span class="shortcut-media avatar rounded-circle bg-gradient-danger">
<i class="fas fa-user"></i> <i class="fas fa-user"></i>
</span> </span>
<small class="text-danger">{{ trans_choice('general.vendors', 1) }}</small> <small class="text-danger">{{ trans_choice('general.vendors', 1) }}</small>
</a> </a>
@endpermission @endcan
@stack('navbar_create_vendor_end') @stack('navbar_create_vendor_end')
</div> </div>
</div> </div>
</li> </li>
@endpermission @endcanany
@stack('navbar_notifications') @stack('navbar_notifications')
@ -197,7 +197,7 @@
@stack('navbar_updates') @stack('navbar_updates')
@permission('read-install-updates') @can('read-install-updates')
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{{ route('updates.index') }}" title="{{ $updates }} Updates Available" role="button" aria-haspopup="true" aria-expanded="false"> <a class="nav-link" href="{{ route('updates.index') }}" title="{{ $updates }} Updates Available" role="button" aria-haspopup="true" aria-expanded="false">
<span> <span>
@ -208,7 +208,7 @@
@endif @endif
</a> </a>
</li> </li>
@endpermission @endcan
@stack('navbar_help_start') @stack('navbar_help_start')
@ -251,45 +251,45 @@
@stack('navbar_profile_edit') @stack('navbar_profile_edit')
@permission(['read-auth-users', 'read-auth-profile']) @can(['read-auth-users', 'read-auth-profile'])
<a href="{{ route('users.edit', $user->id) }}" class="dropdown-item"> <a href="{{ route('users.edit', $user->id) }}" class="dropdown-item">
<i class="fas fa-user"></i> <i class="fas fa-user"></i>
<span>{{ trans('auth.profile') }}</span> <span>{{ trans('auth.profile') }}</span>
</a> </a>
@endpermission @endcan
@permission(['read-auth-users', 'read-auth-roles', 'read-auth-permissions']) @canany(['read-auth-users', 'read-auth-roles', 'read-auth-permissions'])
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@stack('navbar_profile_users') @stack('navbar_profile_users')
@permission('read-auth-users') @can('read-auth-users')
<a href="{{ route('users.index') }}" class="dropdown-item"> <a href="{{ route('users.index') }}" class="dropdown-item">
<i class="fas fa-users"></i> <i class="fas fa-users"></i>
<span>{{ trans_choice('general.users', 2) }}</span> <span>{{ trans_choice('general.users', 2) }}</span>
</a> </a>
@endpermission @endcan
@stack('navbar_profile_roles') @stack('navbar_profile_roles')
@permission('read-auth-roles') @can('read-auth-roles')
<a href="{{ route('roles.index') }}" class="dropdown-item"> <a href="{{ route('roles.index') }}" class="dropdown-item">
<i class="fas fa-list"></i> <i class="fas fa-list"></i>
<span>{{ trans_choice('general.roles', 2) }}</span> <span>{{ trans_choice('general.roles', 2) }}</span>
</a> </a>
@endpermission @endcan
@stack('navbar_profile_permissions_start') @stack('navbar_profile_permissions_start')
@permission('read-auth-permissions') @can('read-auth-permissions')
<a href="{{ route('permissions.index') }}" class="dropdown-item"> <a href="{{ route('permissions.index') }}" class="dropdown-item">
<i class="fas fa-key"></i> <i class="fas fa-key"></i>
<span>{{ trans_choice('general.permissions', 2) }}</span> <span>{{ trans_choice('general.permissions', 2) }}</span>
</a> </a>
@endpermission @endcan
@stack('navbar_profile_permissions_end') @stack('navbar_profile_permissions_end')
@endpermission @endcanany
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>

View File

@ -25,7 +25,7 @@
</div> </div>
<div class="col-auto"> <div class="col-auto">
@permission('delete-common-uploads') @can('delete-common-uploads')
<a href="javascript:void();" id="remove-{{ $column_name }}" @click="onDeleteFile('{{ $file->id }}', '{{ route('uploads.destroy', $file->id) }}', '{{ trans('general.title.delete', ['type' => $column_name]) }}', '{{ trans('general.delete_confirm', ['name' => $file->basename, 'type' => $column_name]) }} ', '{{ trans('general.cancel') }}', '{{ trans('general.delete') }}')" type="button" class="btn btn-sm btn-danger text-white header-button-top"> <a href="javascript:void();" id="remove-{{ $column_name }}" @click="onDeleteFile('{{ $file->id }}', '{{ route('uploads.destroy', $file->id) }}', '{{ trans('general.title.delete', ['type' => $column_name]) }}', '{{ trans('general.delete_confirm', ['name' => $file->basename, 'type' => $column_name]) }} ', '{{ trans('general.cancel') }}', '{{ trans('general.delete') }}')" type="button" class="btn btn-sm btn-danger text-white header-button-top">
<i class="fas fa-times"></i> <i class="fas fa-times"></i>
</a> </a>
@ -35,7 +35,7 @@
<input type="hidden" name="key_{{ $file->id}}" id="file-key-{{ $file->id}}" value="{{ $options['key'] }}" /> <input type="hidden" name="key_{{ $file->id}}" id="file-key-{{ $file->id}}" value="{{ $options['key'] }}" />
<input type="hidden" name="value_{{ $file->id}}" id="file-value-{{ $file->id}}" value="{{ $file->id }}" /> <input type="hidden" name="value_{{ $file->id}}" id="file-value-{{ $file->id}}" value="{{ $file->id }}" />
@endif @endif
@endpermission @endcan
<a href="{{ route('uploads.download', $file->id) }}" type="button" class="btn btn-sm btn-info text-white header-button-top"> <a href="{{ route('uploads.download', $file->id) }}" type="button" class="btn btn-sm btn-info text-white header-button-top">
<i class="fas fa-file-download"></i> <i class="fas fa-file-download"></i>

View File

@ -67,7 +67,7 @@
</div> </div>
</li> </li>
@permission('read-install-updates') @can('read-install-updates')
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{{ route('updates.index') }}" title="{{ $updates }} Updates Available" role="button" aria-haspopup="true" aria-expanded="false"> <a class="nav-link" href="{{ route('updates.index') }}" title="{{ $updates }} Updates Available" role="button" aria-haspopup="true" aria-expanded="false">
<span> <span>
@ -78,7 +78,7 @@
@endif @endif
</a> </a>
</li> </li>
@endpermission @endcan
<li class="nav-item d-none d-md-block"> <li class="nav-item d-none d-md-block">
<a class="nav-link" href="{{ url(trans('header.support_link')) }}" target="_blank" title="{{ trans('general.help') }}" role="button" aria-haspopup="true" aria-expanded="false"> <a class="nav-link" href="{{ url(trans('header.support_link')) }}" target="_blank" title="{{ trans('general.help') }}" role="button" aria-haspopup="true" aria-expanded="false">

View File

@ -1,4 +1,4 @@
@permission(['update-common-widgets', 'delete-common-widgets']) @canany(['update-common-widgets', 'delete-common-widgets'])
<div class="card-header{{ !empty($header_class) ? ' ' . $header_class : '' }}"> <div class="card-header{{ !empty($header_class) ? ' ' . $header_class : '' }}">
<div class="row align-items-center"> <div class="row align-items-center">
@ -14,22 +14,22 @@
</a> </a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
@permission('update-common-widgets') @can('update-common-widgets')
{!! Form::button(trans('general.edit'), [ {!! Form::button(trans('general.edit'), [
'type' => 'button', 'type' => 'button',
'class' => 'dropdown-item', 'class' => 'dropdown-item',
'title' => trans('general.edit'), 'title' => trans('general.edit'),
'@click' => 'onEditWidget(' . $class->model->id . ')' '@click' => 'onEditWidget(' . $class->model->id . ')'
]) !!} ]) !!}
@endpermission @endcan
@permission('delete-common-widgets') @can('delete-common-widgets')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($class->model, 'common/widgets') !!} {!! Form::deleteLink($class->model, 'common/widgets') !!}
@endpermission @endcan
</div> </div>
</div> </div>
</span> </span>
</div> </div>
</div> </div>
</div> </div>
@endpermission @endcanany

View File

@ -1,4 +1,4 @@
@permission(['update-common-widgets', 'delete-common-widgets']) @canany(['update-common-widgets', 'delete-common-widgets'])
<span> <span>
<div class="dropdown card-action-button"> <div class="dropdown card-action-button">
<a class="btn btn-sm items-align-center py-2 mr-0 shadow-none--hover" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a class="btn btn-sm items-align-center py-2 mr-0 shadow-none--hover" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -6,19 +6,19 @@
</a> </a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
@permission('update-common-widgets') @can('update-common-widgets')
{!! Form::button(trans('general.edit'), [ {!! Form::button(trans('general.edit'), [
'type' => 'button', 'type' => 'button',
'class' => 'dropdown-item', 'class' => 'dropdown-item',
'title' => trans('general.edit'), 'title' => trans('general.edit'),
'@click' => 'onEditWidget(' . $class->model->id . ')' '@click' => 'onEditWidget(' . $class->model->id . ')'
]) !!} ]) !!}
@endpermission @endcan
@permission('delete-common-widgets') @can('delete-common-widgets')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($class->model, 'common/widgets') !!} {!! Form::deleteLink($class->model, 'common/widgets') !!}
@endpermission @endcan
</div> </div>
</div> </div>
</span> </span>
@endpermission @endcanany

View File

@ -38,13 +38,13 @@
</div> </div>
</div> </div>
@permission(['update-portal-profile']) @canany(['update-portal-profile'])
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('portal.dashboard') }} {{ Form::saveButtons('portal.dashboard') }}
</div> </div>
</div> </div>
@endpermission @endcanany
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>

View File

@ -212,13 +212,13 @@
</div> </div>
</div> </div>
@permission('update-purchases-bills') @can('update-purchases-bills')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('bills.index') }} {{ Form::saveButtons('bills.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
@endsection @endsection

View File

@ -3,10 +3,10 @@
@section('title', trans_choice('general.bills', 2)) @section('title', trans_choice('general.bills', 2))
@section('new_button') @section('new_button')
@permission('create-purchases-bills') @can('create-purchases-bills')
<a href="{{ route('bills.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('bills.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
<a href="{{ route('import.create', ['group' => 'purchases', 'type' => 'bills']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a> <a href="{{ route('import.create', ['group' => 'purchases', 'type' => 'bills']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a>
@endpermission @endcan
<a href="{{ route('bills.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a> <a href="{{ route('bills.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a>
@endsection @endsection
@ -73,21 +73,21 @@
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@if ($item->status != 'cancelled') @if ($item->status != 'cancelled')
@permission('create-purchases-bills') @can('create-purchases-bills')
<a class="dropdown-item" href="{{ route('bills.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a> <a class="dropdown-item" href="{{ route('bills.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a>
@endpermission @endcan
@permission('update-purchases-bills') @can('update-purchases-bills')
<a class="dropdown-item" href="{{ route('bills.cancelled', $item->id) }}">{{ trans('general.cancel') }}</a> <a class="dropdown-item" href="{{ route('bills.cancelled', $item->id) }}">{{ trans('general.cancel') }}</a>
@endpermission @endcan
@endif @endif
@permission('delete-purchases-bills') @can('delete-purchases-bills')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@if (!$item->reconciled) @if (!$item->reconciled)
{!! Form::deleteLink($item, 'bills.destroy') !!} {!! Form::deleteLink($item, 'bills.destroy') !!}
@endif @endif
@endpermission @endcan
</div> </div>
</div> </div>
</td> </td>

View File

@ -102,9 +102,9 @@
<div class="mt-3"> <div class="mt-3">
@stack('timeline_body_receive_bill_body_button_received_start') @stack('timeline_body_receive_bill_body_button_received_start')
@permission('update-purchases-bills') @can('update-purchases-bills')
<a href="{{ route('bills.received', $bill->id) }}" class="btn btn-danger btn-sm btn-alone">{{ trans('bills.mark_received') }}</a> <a href="{{ route('bills.received', $bill->id) }}" class="btn btn-danger btn-sm btn-alone">{{ trans('bills.mark_received') }}</a>
@endpermission @endcan
@stack('timeline_body_receive_bill_body_button_received_end') @stack('timeline_body_receive_bill_body_button_received_end')
</div> </div>
@else @else
@ -142,9 +142,9 @@
<div class="mt-3"> <div class="mt-3">
@stack('timeline_body_get_paid_body_button_pay_start') @stack('timeline_body_get_paid_body_button_pay_start')
@permission('update-purchases-bills') @can('update-purchases-bills')
<a href="{{ route('bills.paid', $bill->id) }}" class="btn btn-white btn-sm header-button-top">{{ trans('bills.mark_paid') }}</a> <a href="{{ route('bills.paid', $bill->id) }}" class="btn btn-white btn-sm header-button-top">{{ trans('bills.mark_paid') }}</a>
@endpermission @endcan
@stack('timeline_body_get_paid_body_button_pay_end') @stack('timeline_body_get_paid_body_button_pay_end')
@stack('timeline_body_make_payment_body_button_payment_start') @stack('timeline_body_make_payment_body_button_payment_start')
@ -468,9 +468,9 @@
@if ($bill->status != 'cancelled') @if ($bill->status != 'cancelled')
@if ($bill->status != 'paid') @if ($bill->status != 'paid')
@stack('button_pay_start') @stack('button_pay_start')
@permission('update-purchases-bills') @can('update-purchases-bills')
<a class="dropdown-item" href="{{ route('bills.paid', $bill->id) }}">{{ trans('bills.mark_paid') }}</a> <a class="dropdown-item" href="{{ route('bills.paid', $bill->id) }}">{{ trans('bills.mark_paid') }}</a>
@endpermission @endcan
@if (empty($bill->paid) || ($bill->paid != $bill->amount)) @if (empty($bill->paid) || ($bill->paid != $bill->amount))
<button class="dropdown-item" id="button-payment" @click="onPayment">{{ trans('bills.add_payment') }}</button> <button class="dropdown-item" id="button-payment" @click="onPayment">{{ trans('bills.add_payment') }}</button>
@ -481,7 +481,7 @@
@stack('button_dropdown_divider_1') @stack('button_dropdown_divider_1')
@permission('update-purchases-bills') @can('update-purchases-bills')
@stack('button_received_start') @stack('button_received_start')
@if ($bill->status == 'draft') @if ($bill->status == 'draft')
<a class="dropdown-item" href="{{ route('bills.received', $bill->id) }}">{{ trans('bills.mark_received') }}</a></a> <a class="dropdown-item" href="{{ route('bills.received', $bill->id) }}">{{ trans('bills.mark_received') }}</a></a>
@ -489,30 +489,30 @@
<button type="button" class="dropdown-item" disabled="disabled">{{ trans('bills.mark_received') }}</button> <button type="button" class="dropdown-item" disabled="disabled">{{ trans('bills.mark_received') }}</button>
@endif @endif
@stack('button_received_end') @stack('button_received_end')
@endpermission @endcan
@endif @endif
@stack('button_pdf_start') @stack('button_pdf_start')
<a class="dropdown-item" href="{{ route('bills.pdf', $bill->id) }}">{{ trans('bills.download_pdf') }}</a> <a class="dropdown-item" href="{{ route('bills.pdf', $bill->id) }}">{{ trans('bills.download_pdf') }}</a>
@stack('button_pdf_end') @stack('button_pdf_end')
@permission('update-purchases-bills') @can('update-purchases-bills')
@if ($bill->status != 'cancelled') @if ($bill->status != 'cancelled')
@stack('button_cancelled_start') @stack('button_cancelled_start')
<a class="dropdown-item" href="{{ route('bills.cancelled', $bill->id) }}">{{ trans('general.cancel') }}</a> <a class="dropdown-item" href="{{ route('bills.cancelled', $bill->id) }}">{{ trans('general.cancel') }}</a>
@stack('button_cancelled_end') @stack('button_cancelled_end')
@endif @endif
@endpermission @endcan
@stack('button_dropdown_divider_2') @stack('button_dropdown_divider_2')
@permission('delete-purchases-bills') @can('delete-purchases-bills')
@if (!$bill->reconciled) @if (!$bill->reconciled)
@stack('button_delete_start') @stack('button_delete_start')
{!! Form::deleteLink($bill, 'purchases/bills') !!} {!! Form::deleteLink($bill, 'purchases/bills') !!}
@stack('button_delete_end') @stack('button_delete_end')
@endif @endif
@endpermission @endcan
@stack('button_dropdown_end') @stack('button_dropdown_end')
</div> </div>
</div> </div>

View File

@ -73,13 +73,13 @@
</div> </div>
</div> </div>
@permission('update-purchases-payments') @can('update-purchases-payments')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('payments.index') }} {{ Form::saveButtons('payments.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{{ Form::hidden('type', 'expense') }} {{ Form::hidden('type', 'expense') }}
{!! Form::close() !!} {!! Form::close() !!}

View File

@ -3,10 +3,10 @@
@section('title', trans_choice('general.payments', 2)) @section('title', trans_choice('general.payments', 2))
@section('new_button') @section('new_button')
@permission('create-purchases-payments') @can('create-purchases-payments')
<a href="{{ route('payments.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('payments.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
<a href="{{ route('import.create', ['group' => 'purchases', 'type' => 'payments']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a> <a href="{{ route('import.create', ['group' => 'purchases', 'type' => 'payments']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a>
@endpermission @endcan
<a href="{{ route('payments.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a> <a href="{{ route('payments.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a>
@endsection @endsection
@ -93,15 +93,15 @@
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@endif @endif
@if (empty($item->document_id)) @if (empty($item->document_id))
@permission('create-purchases-payments') @can('create-purchases-payments')
<a class="dropdown-item" href="{{ route('payments.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a> <a class="dropdown-item" href="{{ route('payments.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@endpermission @endcan
@endif @endif
@if (!$item->reconciled) @if (!$item->reconciled)
@permission('delete-purchases-payments') @can('delete-purchases-payments')
{!! Form::deleteLink($item, 'payments.destroy') !!} {!! Form::deleteLink($item, 'payments.destroy') !!}
@endpermission @endcan
@endif @endif
</div> </div>
</div> </div>

View File

@ -40,13 +40,13 @@
</div> </div>
</div> </div>
@permission('update-purchases-vendors') @can('update-purchases-vendors')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('vendors.index') }} {{ Form::saveButtons('vendors.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{{ Form::hidden('type', 'vendor') }} {{ Form::hidden('type', 'vendor') }}
{!! Form::close() !!} {!! Form::close() !!}

View File

@ -3,10 +3,10 @@
@section('title', trans_choice('general.vendors', 2)) @section('title', trans_choice('general.vendors', 2))
@section('new_button') @section('new_button')
@permission('create-purchases-vendors') @can('create-purchases-vendors')
<a href="{{ route('vendors.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('vendors.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
<a href="{{ route('import.create', ['group' => 'purchases', 'type' => 'vendors']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a> <a href="{{ route('import.create', ['group' => 'purchases', 'type' => 'vendors']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a>
@endpermission @endcan
<a href="{{ route('vendors.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a> <a href="{{ route('vendors.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a>
@endsection @endsection
@ -82,14 +82,14 @@
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('vendors.show', $item->id) }}">{{ trans('general.show') }}</a> <a class="dropdown-item" href="{{ route('vendors.show', $item->id) }}">{{ trans('general.show') }}</a>
<a class="dropdown-item" href="{{ route('vendors.edit', $item->id) }}">{{ trans('general.edit') }}</a> <a class="dropdown-item" href="{{ route('vendors.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@permission('create-purchases-vendors') @can('create-purchases-vendors')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{ route('vendors.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a> <a class="dropdown-item" href="{{ route('vendors.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a>
@endpermission @endcan
@permission('delete-purchases-vendors') @can('delete-purchases-vendors')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($item, 'vendors.destroy') !!} {!! Form::deleteLink($item, 'vendors.destroy') !!}
@endpermission @endcan
</div> </div>
</div> </div>
</td> </td>

View File

@ -71,13 +71,13 @@
</div> </div>
</div> </div>
@permission('update-sales-customers') @can('update-sales-customers')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('customers.index') }} {{ Form::saveButtons('customers.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{{ Form::hidden('type', 'customer') }} {{ Form::hidden('type', 'customer') }}

View File

@ -3,10 +3,10 @@
@section('title', trans_choice('general.customers', 2)) @section('title', trans_choice('general.customers', 2))
@section('new_button') @section('new_button')
@permission('create-sales-customers') @can('create-sales-customers')
<a href="{{ route('customers.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('customers.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
<a href="{{ route('import.create', ['group' => 'sales', 'type' => 'customers']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a> <a href="{{ route('import.create', ['group' => 'sales', 'type' => 'customers']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a>
@endpermission @endcan
<a href="{{ route('customers.export', request()->input()) }}" class="btn btn-white btn-sm header-button-top">{{ trans('general.export') }}</a> <a href="{{ route('customers.export', request()->input()) }}" class="btn btn-white btn-sm header-button-top">{{ trans('general.export') }}</a>
@endsection @endsection
@ -84,14 +84,14 @@
<a class="dropdown-item" href="{{ route('customers.edit', $item->id) }}">{{ trans('general.edit') }}</a> <a class="dropdown-item" href="{{ route('customers.edit', $item->id) }}">{{ trans('general.edit') }}</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@permission('create-sales-customers') @can('create-sales-customers')
<a class="dropdown-item" href="{{ route('customers.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a> <a class="dropdown-item" href="{{ route('customers.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@endpermission @endcan
@permission('delete-sales-customers') @can('delete-sales-customers')
{!! Form::deleteLink($item, 'customers.destroy') !!} {!! Form::deleteLink($item, 'customers.destroy') !!}
@endpermission @endcan
</div> </div>
</div> </div>
</td> </td>

View File

@ -214,13 +214,13 @@
</div> </div>
</div> </div>
@permission('update-sales-invoices') @can('update-sales-invoices')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('invoices.index') }} {{ Form::saveButtons('invoices.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
@endsection @endsection

View File

@ -3,10 +3,10 @@
@section('title', trans_choice('general.invoices', 2)) @section('title', trans_choice('general.invoices', 2))
@section('new_button') @section('new_button')
@permission('create-sales-invoices') @can('create-sales-invoices')
<a href="{{ route('invoices.create') }}" class="btn btn-primary btn-sm btn-success header-button-top">{{ trans('general.add_new') }}</a> <a href="{{ route('invoices.create') }}" class="btn btn-primary btn-sm btn-success header-button-top">{{ trans('general.add_new') }}</a>
<a href="{{ route('import.create', ['group' => 'sales', 'type' => 'invoices']) }}" class="btn btn-white btn-sm header-button-top">{{ trans('import.import') }}</a> <a href="{{ route('import.create', ['group' => 'sales', 'type' => 'invoices']) }}" class="btn btn-white btn-sm header-button-top">{{ trans('import.import') }}</a>
@endpermission @endcan
<a href="{{ route('invoices.export', request()->input()) }}" class="btn btn-white btn-sm header-button-top">{{ trans('general.export') }}</a> <a href="{{ route('invoices.export', request()->input()) }}" class="btn btn-white btn-sm header-button-top">{{ trans('general.export') }}</a>
@endsection @endsection
@ -72,21 +72,21 @@
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@if ($item->status != 'cancelled') @if ($item->status != 'cancelled')
@permission('create-sales-invoices') @can('create-sales-invoices')
<a class="dropdown-item" href="{{ route('invoices.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a> <a class="dropdown-item" href="{{ route('invoices.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@endpermission @endcan
@permission('update-sales-invoices') @can('update-sales-invoices')
<a class="dropdown-item" href="{{ route('invoices.cancelled', $item->id) }}">{{ trans('general.cancel') }}</a> <a class="dropdown-item" href="{{ route('invoices.cancelled', $item->id) }}">{{ trans('general.cancel') }}</a>
@endpermission @endcan
@endif @endif
@permission('delete-sales-invoices') @can('delete-sales-invoices')
@if (!$item->reconciled) @if (!$item->reconciled)
{!! Form::deleteLink($item, 'invoices.destroy') !!} {!! Form::deleteLink($item, 'invoices.destroy') !!}
@endif @endif
@endpermission @endcan
</div> </div>
</div> </div>
</td> </td>

View File

@ -100,7 +100,7 @@
<div class="mt-3"> <div class="mt-3">
@stack('timeline_body_send_invoice_body_button_sent_start') @stack('timeline_body_send_invoice_body_button_sent_start')
@permission('update-sales-invoices') @can('update-sales-invoices')
@if($invoice->status == 'draft') @if($invoice->status == 'draft')
<a href="{{ route('invoices.sent', $invoice->id) }}" class="btn btn-white btn-sm header-button-top">{{ trans('invoices.mark_sent') }}</a> <a href="{{ route('invoices.sent', $invoice->id) }}" class="btn btn-white btn-sm header-button-top">{{ trans('invoices.mark_sent') }}</a>
@else @else
@ -108,7 +108,7 @@
<span class="text-disabled">{{ trans('invoices.mark_sent') }}</span> <span class="text-disabled">{{ trans('invoices.mark_sent') }}</span>
</button> </button>
@endif @endif
@endpermission @endcan
@stack('timeline_body_send_invoice_body_button_sent_end') @stack('timeline_body_send_invoice_body_button_sent_end')
@stack('timeline_body_send_invoice_body_button_email_start') @stack('timeline_body_send_invoice_body_button_email_start')
@ -161,9 +161,9 @@
<div class="mt-3"> <div class="mt-3">
@stack('timeline_body_get_paid_body_button_pay_start') @stack('timeline_body_get_paid_body_button_pay_start')
@permission('update-sales-invoices') @can('update-sales-invoices')
<a href="{{ route('invoices.paid', $invoice->id) }}" class="btn btn-white btn-sm header-button-top">{{ trans('invoices.mark_paid') }}</a> <a href="{{ route('invoices.paid', $invoice->id) }}" class="btn btn-white btn-sm header-button-top">{{ trans('invoices.mark_paid') }}</a>
@endpermission @endcan
@stack('timeline_body_get_paid_body_button_pay_end') @stack('timeline_body_get_paid_body_button_pay_end')
@stack('timeline_body_get_paid_body_button_payment_start') @stack('timeline_body_get_paid_body_button_payment_start')
@ -490,9 +490,9 @@
@if ($invoice->status != 'cancelled') @if ($invoice->status != 'cancelled')
@if ($invoice->status != 'paid') @if ($invoice->status != 'paid')
@stack('button_pay_start') @stack('button_pay_start')
@permission('update-sales-invoices') @can('update-sales-invoices')
<a class="dropdown-item" href="{{ route('invoices.paid', $invoice->id) }}">{{ trans('invoices.mark_paid') }}</a> <a class="dropdown-item" href="{{ route('invoices.paid', $invoice->id) }}">{{ trans('invoices.mark_paid') }}</a>
@endpermission @endcan
@if (empty($invoice->paid) || ($invoice->paid != $invoice->amount)) @if (empty($invoice->paid) || ($invoice->paid != $invoice->amount))
<button class="dropdown-item" id="button-payment" @click="onPayment">{{ trans('invoices.add_payment') }}</button> <button class="dropdown-item" id="button-payment" @click="onPayment">{{ trans('invoices.add_payment') }}</button>
@ -503,7 +503,7 @@
@stack('button_dropdown_divider_1') @stack('button_dropdown_divider_1')
@permission('update-sales-invoices') @can('update-sales-invoices')
@stack('button_sent_start') @stack('button_sent_start')
@if ($invoice->status == 'draft') @if ($invoice->status == 'draft')
<a class="dropdown-item" href="{{ route('invoices.sent', $invoice->id) }}">{{ trans('invoices.mark_sent') }}</a> <a class="dropdown-item" href="{{ route('invoices.sent', $invoice->id) }}">{{ trans('invoices.mark_sent') }}</a>
@ -511,7 +511,7 @@
<button type="button" class="dropdown-item" disabled="disabled"><span class="text-disabled">{{ trans('invoices.mark_sent') }}</span></button> <button type="button" class="dropdown-item" disabled="disabled"><span class="text-disabled">{{ trans('invoices.mark_sent') }}</span></button>
@endif @endif
@stack('button_sent_end') @stack('button_sent_end')
@endpermission @endcan
@stack('button_email_start') @stack('button_email_start')
@if ($invoice->contact_email) @if ($invoice->contact_email)
@ -528,23 +528,23 @@
<a class="dropdown-item" href="{{ route('invoices.pdf', $invoice->id) }}">{{ trans('invoices.download_pdf') }}</a> <a class="dropdown-item" href="{{ route('invoices.pdf', $invoice->id) }}">{{ trans('invoices.download_pdf') }}</a>
@stack('button_pdf_end') @stack('button_pdf_end')
@permission('update-sales-invoices') @can('update-sales-invoices')
@if ($invoice->status != 'cancelled') @if ($invoice->status != 'cancelled')
@stack('button_cancelled_start') @stack('button_cancelled_start')
<a class="dropdown-item" href="{{ route('invoices.cancelled', $invoice->id) }}">{{ trans('general.cancel') }}</a> <a class="dropdown-item" href="{{ route('invoices.cancelled', $invoice->id) }}">{{ trans('general.cancel') }}</a>
@stack('button_cancelled_end') @stack('button_cancelled_end')
@endif @endif
@endpermission @endcan
@stack('button_dropdown_divider_2') @stack('button_dropdown_divider_2')
@permission('delete-sales-invoices') @can('delete-sales-invoices')
@if (!$invoice->reconciled) @if (!$invoice->reconciled)
@stack('button_delete_start') @stack('button_delete_start')
{!! Form::deleteLink($invoice, 'sales/invoices') !!} {!! Form::deleteLink($invoice, 'sales/invoices') !!}
@stack('button_delete_end') @stack('button_delete_end')
@endif @endif
@endpermission @endcan
@stack('button_dropdown_end') @stack('button_dropdown_end')
</div> </div>
</div> </div>

View File

@ -73,13 +73,13 @@
</div> </div>
</div> </div>
@permission('update-sales-revenues') @can('update-sales-revenues')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('revenues.index') }} {{ Form::saveButtons('revenues.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{{ Form::hidden('type', 'income') }} {{ Form::hidden('type', 'income') }}
{!! Form::close() !!} {!! Form::close() !!}

View File

@ -3,10 +3,10 @@
@section('title', trans_choice('general.revenues', 2)) @section('title', trans_choice('general.revenues', 2))
@section('new_button') @section('new_button')
@permission('create-sales-revenues') @can('create-sales-revenues')
<a href="{{ route('revenues.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('revenues.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
<a href="{{ route('import.create', ['group' => 'sales', 'type' => 'revenues']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a> <a href="{{ route('import.create', ['group' => 'sales', 'type' => 'revenues']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a>
@endpermission @endcan
<a href="{{ route('revenues.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a> <a href="{{ route('revenues.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a>
@endsection @endsection
@ -93,15 +93,15 @@
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@endif @endif
@if (empty($item->document_id)) @if (empty($item->document_id))
@permission('create-sales-revenues') @can('create-sales-revenues')
<a class="dropdown-item" href="{{ route('revenues.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a> <a class="dropdown-item" href="{{ route('revenues.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@endpermission @endcan
@endif @endif
@if (!$item->reconciled) @if (!$item->reconciled)
@permission('delete-sales-revenues') @can('delete-sales-revenues')
{!! Form::deleteLink($item, 'revenues.destroy') !!} {!! Form::deleteLink($item, 'revenues.destroy') !!}
@endpermission @endcan
@endif @endif
</div> </div>
</div> </div>

View File

@ -46,13 +46,13 @@
</div> </div>
</div> </div>
@permission('update-settings-categories') @can('update-settings-categories')
<div class="card-footer"> <div class="card-footer">
<div class="row save-buttons"> <div class="row save-buttons">
{{ Form::saveButtons('categories.index') }} {{ Form::saveButtons('categories.index') }}
</div> </div>
</div> </div>
@endpermission @endcan
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
@endsection @endsection

View File

@ -2,11 +2,11 @@
@section('title', trans_choice('general.categories', 2)) @section('title', trans_choice('general.categories', 2))
@permission('create-settings-categories') @can('create-settings-categories')
@section('new_button') @section('new_button')
<a href="{{ route('categories.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a> <a href="{{ route('categories.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
@endsection @endsection
@endpermission @endcan
@section('content') @section('content')
<div class="card"> <div class="card">
@ -69,10 +69,10 @@
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow"> <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('categories.edit', $item->id) }}">{{ trans('general.edit') }}</a> <a class="dropdown-item" href="{{ route('categories.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@if ($item->id != $transfer_id) @if ($item->id != $transfer_id)
@permission('delete-settings-categories') @can('delete-settings-categories')
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
{!! Form::deleteLink($item, 'categories.destroy') !!} {!! Form::deleteLink($item, 'categories.destroy') !!}
@endpermission @endcan
@endif @endif
</div> </div>
</div> </div>

Some files were not shown because too many files have changed in this diff Show More