Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
ini_set('memory_limit','1024M');
$finder = PhpCsFixer\Finder::create()
->notPath('bootstrap/cache')
->notPath('storage')
Expand Down
17 changes: 9 additions & 8 deletions app/Blade/Directives/Icon.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<?php
<?php

namespace App\Blade\Directives;

use Illuminate\Support\Facades\Blade;

class Icon
{
public static function register()
{
Blade::directive('icon', function ($icon) {
$icon = str_replace('\'', '"', $icon);
return "<i class={$icon}></i>";
public static function register()
{
Blade::directive('icon', function ($icon) {
$icon = str_replace('\'', '"', $icon);

return "<i class={$icon}></i>";
});
}
}
}
}
6 changes: 5 additions & 1 deletion app/Http/Controllers/Api/Datatable/Manage/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@

use App\Http\Controllers\Controller;
use App\Models\User;
use App\Transformers\Datatable\UserTransformer;
use Illuminate\Http\Request;

class UserController extends Controller
{
public function __invoke(Request $request)
{
return app('datatables')->eloquent(User::datatable())->toJson();
return app('datatables')
->eloquent(User::datatable())
->setTransformer(new UserTransformer())
->toJson();
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/LanguageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class LanguageController extends Controller
public function __invoke(Request $request, $language)
{
app()->setLocale($language);

swal()->success(
__('Language'),
__('Current application language has been set to ' . __(strtoupper($language)) . '.')
Expand Down
7 changes: 1 addition & 6 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ class Kernel extends HttpKernel
'throttle:60,1',
'bindings',
],

'datatable' => [
'throttle:60,1',
'bindings',
],
];

/**
Expand All @@ -69,6 +64,6 @@ class Kernel extends HttpKernel
'minify' => \App\Http\Middleware\MinifyHtml::class,
'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,
'theme' => \CleaniqueCoders\Themer\Http\Middleware\ThemeLoader::class,
'theme' => \CleaniqueCoders\Themer\Http\Middleware\ThemeLoader::class,
];
}
2 changes: 1 addition & 1 deletion app/Macros/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Response
{
public static function registerMacros()
{
HttpResponse::macro('api', function ($data, $message = null, $status = true, $code = 200) {
HttpResponse::macro('api', function ($data = null, $message = null, $status = true, $code = 200) {
return response()->json([
'data' => $data,
'message' => $message,
Expand Down
12 changes: 6 additions & 6 deletions app/Observers/ReferenceObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ class ReferenceObserver
*/
public function creating(Model $model)
{
if (Schema::hasColumn($model->getTable(), 'reference') && is_null($model->reference)) {
$count = $model::count();
$count = method_exists($model, 'getCounter') ? $model->getCounter() : ($model::count() ?? 0);

$reference = isset($model->reference_prefix) ?
generate_reference($model->reference_prefix, $count) :
generate_reference(config('document.prefix'), $count);
$column = method_exists($model, 'getReferenceColumn') ? $model->getReferenceColumn() : 'reference';

$model->reference = $reference;
$prefix = method_exists($model, 'referencePrefix') ? $model->referencePrefix() : config('document.prefix');

if (Schema::hasColumn($model->getTable(), $column) && is_null($model->$column)) {
$model->$column = generate_reference($prefix, $count);
}
}
}
12 changes: 7 additions & 5 deletions app/Providers/BladeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Blade;

/**
* @todo To create custom Blade Directives using Blade::component
*/
class BladeServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
\App\Blade\Directives\Icon::register();

// @todo to figure out, how to pass data to the custom component
Blade::component('components.cards.figure', 'figure');
}

/**
* Register services.
*
* @return void
*/
public function register()
{
//
}
}
2 changes: 1 addition & 1 deletion app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function mapApiRoutes()
protected function mapDatatableRoutes()
{
Route::prefix('api/datatable')
->middleware('datatable')
->middleware('api')
->as('api.datatable.')
->namespace($this->namespace . '\Api\Datatable')
->group(base_path('routes/datatable.php'));
Expand Down
11 changes: 3 additions & 8 deletions app/Providers/ThemeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@

namespace App\Providers;

use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\Compilers\Concerns\CompilesLayouts;
use Illuminate\Support\Str;
use Illuminate\View\Compilers\Concerns\CompilesLayouts;

class ThemeServiceProvider extends ServiceProvider
{
use CompilesLayouts;

/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
Expand All @@ -23,18 +20,16 @@ public function boot()

/**
* Register services.
*
* @return void
*/
public function register()
{
//
}

/**
* Strip the parentheses from the given expression.
*
* @param string $expression
* @param string $expression
*
* @return string
*/
public function stripParentheses($expression)
Expand Down
15 changes: 10 additions & 5 deletions app/Services/Hashids.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,23 @@ class Hashids
*/
protected $hashids;

public function __construct($salt, $length, $alphabet)
public function __construct(string $salt, int $length, string $alphabet)
{
$this->hashids = new HashidsProvider($salt, $length, $alphabet);
}

/**
* Create an instance of Hashids.
*
* @return App\Services\Hashids
* @return static
*/
public static function make($salt, $length, $alphabet)
public static function make(?string $salt, ?int $length, ?string $alphabet)
{
$salt = is_null($salt) ? config('hashids.salt') : config('hashids.salt') . $salt;
$length = $length ?? config('hashids.length');
$alphabet = $alphabet ?? config('hashids.alphabet');
$salt = \Illuminate\Support\Facades\Hash::make($salt);

return new self($salt, $length, $alphabet);
}

Expand All @@ -50,11 +55,11 @@ public function encode(int $value): string
*
* @return int|null
*/
public function decode(string $value): int
public function decode(string $value): ?int
{
$value = $this->hashids->decode($value);

if (is_array($value)) {
if (is_array($value) && sizeof($value) > 0) {
return $value[0];
} else {
return null;
Expand Down
7 changes: 1 addition & 6 deletions app/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,8 @@ function generate_reference($prefix = 'DOCUMENT REFERENCE', $count = false)
* Hashids Helper
*/
if (! function_exists('hashids')) {
function hashids($salt = null, $length = null, $alphabet = null)
function hashids(?string $salt = null, ?int $length = null, ?string $alphabet = null): \App\Services\Hashids
{
$salt = is_null($salt) ? config('hashids.salt') : config('hashids.salt') . $salt;
$length = is_null($length) ? config('hashids.length') : $length;
$alphabet = is_null($alphabet) ? config('hashids.alphabet') : $alphabet;
$salt = \Illuminate\Support\Facades\Hash::make($salt);

return \App\Services\Hashids::make($salt, $length, $alphabet);
}
}
Expand Down
23 changes: 23 additions & 0 deletions app/Transformers/Datatable/UserTransformer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace App\Transformers\Datatable;

use App\Models\User;
use League\Fractal\TransformerAbstract;

class UserTransformer extends TransformerAbstract
{
/**
* @param \App\Models\User $user
*
* @return array
*/
public function transform(User $user)
{
return [
'hashslug' => $user->hashslug,
'name' => $user->name,
'email' => $user->email,
];
}
}
27 changes: 14 additions & 13 deletions config/theme.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<?php
<?php


return [
/**
* Set default theme. Default is Tabler.
*/
'default' => env('THEME_DEFAULT', 'tabler'),
/*
* Set default theme. Default is Tabler.
*/
'default' => env('THEME_DEFAULT', 'tabler'),

/**
* Available Themes in the application
* This can be use for switchable theme feature.
*/
'themes' => [
'tabler'
]
];
/*
* Available Themes in the application
* This can be use for switchable theme feature.
*/
'themes' => [
'tabler',
],
];
1 change: 0 additions & 1 deletion phpunit.dusk.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
</phpunit>
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="base64:aO0cMJ57rU7MmkR3iYsRQOPNU+hN5gUTrWajrgvlW5I="/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
</phpunit>
4 changes: 2 additions & 2 deletions resources/lang/ms/passwords.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
| has failed, such as for an invalid token or invalid new password.
|
*/

'password' => 'Katalaluan hendaklah sekurang-kurangnya enam aksara dan mesti sama dengan katalaluan pengesahan.',
'reset' => 'Katalaluan telah ditetapkan semula.',
'sent' => 'Kami telah menghantar emel untuk tetapan katalaluan.',
'token' => 'Token tetapan semula katalaluan tidak sah.',
'user' => "Kami tidak menjumpai pengguna dengan emel yang diberikan.",
'user' => 'Kami tidak menjumpai pengguna dengan emel yang diberikan.',
];
4 changes: 4 additions & 0 deletions resources/views/components/datatable.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
deferRender: false,
ajax: {
url:'{!! route($route_name, $param ?? null) !!}',
beforeSend: function (request) {
request.setRequestHeader("Accept", '{{ config('api.header.accept') }}');
request.setRequestHeader("X-CSRF-TOKEN", '{{ csrf_token() }}');
},
{{ $datatable_data or ''}}
},
columns: @json($columns),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@push('scripts')
<script src="{{ asset('js/moment.js') }}"></script>
<script src="{{ asset('js/datetimepicker.js') }}"></script>
@endpush

@push('styles')
<link rel="stylesheet" href="{{ asset('css/datetimepicker.css') }}">
@endpush
7 changes: 7 additions & 0 deletions resources/views/components/forms/assets/dropzone.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@push('sctyles')
<link rel="stylesheet" href="{{ asset('css/dropzone.css') }}">
@endpush

@push('scripts')
<script type="text/javascript" src="{{ asset('js/dropzone.js') }}"></script>
@endpush
7 changes: 7 additions & 0 deletions resources/views/components/forms/assets/select2.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@push('styles')
<link rel="stylesheet" href="{{ asset('css/select2.css') }}">
@endpush

@push('scripts')
<script type="text/javascript" src="{{ asset('js/select2.js') }}"></script>
@endpush
10 changes: 10 additions & 0 deletions resources/views/components/forms/assets/textarea.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@push('styles')
<style>
.ck-editor__editable {
min-height: 480px;
}
</style>
@endpush
@push('scripts')
<script src="{{ asset('js/ckeditor/ckeditor.js') }}"></script>
@endpush
Loading