Compare commits
2 Commits
ed7182f9fd
...
3fda04a881
| Author | SHA1 | Date |
|---|---|---|
|
|
3fda04a881 | |
|
|
c445ee43e3 |
|
|
@ -27,12 +27,12 @@ class ListRequest extends FormRequest
|
|||
'search' => 'nullable',
|
||||
|
||||
'filter' => 'nullable|array',
|
||||
'filter.*.column' => 'required|in:name',
|
||||
'filter.*.column' => 'required|in:code,name,sheet,type,category,subcategory',
|
||||
'filter.*.operator' => 'nullable|in:eq,in',
|
||||
'filter.*.query' => 'required',
|
||||
|
||||
'sort' => 'nullable|array',
|
||||
'sort.column' => 'nullable|in:name',
|
||||
'sort.column' => 'nullable|in:code,name,sheet,type,category,subcategory',
|
||||
'sort.dir' => 'nullable',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class StoreRequest extends FormRequest
|
|||
'category' => 'required|string',
|
||||
'subcategory' => 'nullable|string',
|
||||
'structure' => 'required|string',
|
||||
'totaling' => 'nullable|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class Account extends Model
|
|||
use HasFactory;
|
||||
use LogsActivity;
|
||||
|
||||
protected $fillable = ['code', 'name','sheet','type','category','subcategory','structure'];
|
||||
protected $fillable = ['code', 'name','sheet','type','category','subcategory','structure','totaling'];
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Repositories\Accounting;
|
||||
|
||||
use App\Models\Account;
|
||||
use DB;
|
||||
|
||||
class AccountRepository
|
||||
{
|
||||
|
|
@ -15,7 +16,7 @@ class AccountRepository
|
|||
$sortDir = @$params["sort"]["dir"] ?? "desc";
|
||||
|
||||
return Account::skip($offset)
|
||||
->orderBy($sortColumn, $sortDir)
|
||||
->orderBy(DB::raw("structure::ltree"), "asc")
|
||||
|
||||
->when(@$params["filter"], function ($query) use ($params) {
|
||||
foreach ($params["filter"] as $filter) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Repositories\Auth;
|
||||
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use App\Models\User;
|
||||
use Hash;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,18 @@ class RoleRepository
|
|||
$offset = @$params["offset"] ?? 0;
|
||||
$sortColumn = @$params["sort"]["column"] ?? "id";
|
||||
$sortDir = @$params["sort"]["dir"] ?? "desc";
|
||||
$search = @$params["search"] ?? 0;
|
||||
|
||||
return Role::skip($offset)
|
||||
->orderBy($sortColumn, $sortDir)
|
||||
|
||||
->when($search, function ($query) use ($search){
|
||||
$query->where(function($query) use ($search){
|
||||
$query->where("name","ilike","%$search%");
|
||||
$query->orWhere("code","ilike","%$search%");
|
||||
});
|
||||
})
|
||||
|
||||
->when(@$params["filter"], function ($query) use ($params) {
|
||||
foreach ($params["filter"] as $filter) {
|
||||
$query->where($filter["column"], $filter["query"]);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class AccountFactory extends Factory
|
|||
'type' => fake()->randomElement(["header","posting","begin-total","end-total"]),
|
||||
'category' => fake()->name(),
|
||||
'subcategory' => fake()->name(),
|
||||
'structure' => fake()->name(),
|
||||
'structure' => str_replace(" ",".",strtolower(fake()->name())),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@ return new class extends Migration
|
|||
$table->string('code')->unique();
|
||||
$table->string('name');
|
||||
$table->string('sheet'); // Balance/Income
|
||||
$table->string('category'); // Assets, Equity, Liabilities, Income, Expense, Cost of Goods
|
||||
$table->string('subcategory');
|
||||
$table->string('type'); // Header, Begin-Total, Posting, End-Total
|
||||
$table->string('category')->nullable(); // Assets, Equity, Liabilities, Income, Expense, Cost of Goods
|
||||
$table->string('subcategory')->nullable();
|
||||
$table->string('type')->nullable(); // Header, Begin-Total, Posting, End-Total
|
||||
$table->string('structure');
|
||||
$table->string('totaling')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateActivityLogTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->create(config('activitylog.table_name'), function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('log_name')->nullable();
|
||||
$table->text('description');
|
||||
$table->nullableMorphs('subject', 'subject');
|
||||
$table->nullableMorphs('causer', 'causer');
|
||||
$table->json('properties')->nullable();
|
||||
$table->timestamps();
|
||||
$table->index('log_name');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name'));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddEventColumnToActivityLogTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||
$table->string('event')->nullable()->after('subject_type');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||
$table->dropColumn('event');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddBatchUuidColumnToActivityLogTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||
$table->uuid('batch_uuid')->nullable()->after('properties');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||
$table->dropColumn('batch_uuid');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -26,4 +26,19 @@ class LoginTest extends TestCase
|
|||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* A basic feature test example.
|
||||
*/
|
||||
public function test_fail(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
$response = $this->post('/auth/login',[
|
||||
"email" => $user->email,
|
||||
"password" => "fail",
|
||||
]);
|
||||
|
||||
$response->assertStatus(422);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue