Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.

Commit b7ada0e

Browse files
authored
Merge pull request #14 from cleaniquecoders/develop
Develop
2 parents 60268e8 + 71e5787 commit b7ada0e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+478
-200
lines changed

.php_cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
ini_set('memory_limit','1024M');
23
$finder = PhpCsFixer\Finder::create()
34
->notPath('bootstrap/cache')
45
->notPath('storage')

app/Blade/Directives/Icon.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
<?php
1+
<?php
22

33
namespace App\Blade\Directives;
44

55
use Illuminate\Support\Facades\Blade;
66

77
class Icon
88
{
9-
public static function register()
10-
{
11-
Blade::directive('icon', function ($icon) {
12-
$icon = str_replace('\'', '"', $icon);
13-
return "<i class={$icon}></i>";
9+
public static function register()
10+
{
11+
Blade::directive('icon', function ($icon) {
12+
$icon = str_replace('\'', '"', $icon);
13+
14+
return "<i class={$icon}></i>";
1415
});
15-
}
16-
}
16+
}
17+
}

app/Http/Controllers/Api/Datatable/Manage/UserController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44

55
use App\Http\Controllers\Controller;
66
use App\Models\User;
7+
use App\Transformers\Datatable\UserTransformer;
78
use Illuminate\Http\Request;
89

910
class UserController extends Controller
1011
{
1112
public function __invoke(Request $request)
1213
{
13-
return app('datatables')->eloquent(User::datatable())->toJson();
14+
return app('datatables')
15+
->eloquent(User::datatable())
16+
->setTransformer(new UserTransformer())
17+
->toJson();
1418
}
1519
}

app/Http/Controllers/LanguageController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class LanguageController extends Controller
99
public function __invoke(Request $request, $language)
1010
{
1111
app()->setLocale($language);
12-
12+
1313
swal()->success(
1414
__('Language'),
1515
__('Current application language has been set to ' . __(strtoupper($language)) . '.')

app/Http/Kernel.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ class Kernel extends HttpKernel
4343
'throttle:60,1',
4444
'bindings',
4545
],
46-
47-
'datatable' => [
48-
'throttle:60,1',
49-
'bindings',
50-
],
5146
];
5247

5348
/**
@@ -69,6 +64,6 @@ class Kernel extends HttpKernel
6964
'minify' => \App\Http\Middleware\MinifyHtml::class,
7065
'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
7166
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,
72-
'theme' => \CleaniqueCoders\Themer\Http\Middleware\ThemeLoader::class,
67+
'theme' => \CleaniqueCoders\Themer\Http\Middleware\ThemeLoader::class,
7368
];
7469
}

app/Macros/Http/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Response
88
{
99
public static function registerMacros()
1010
{
11-
HttpResponse::macro('api', function ($data, $message = null, $status = true, $code = 200) {
11+
HttpResponse::macro('api', function ($data = null, $message = null, $status = true, $code = 200) {
1212
return response()->json([
1313
'data' => $data,
1414
'message' => $message,

app/Observers/ReferenceObserver.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ class ReferenceObserver
2121
*/
2222
public function creating(Model $model)
2323
{
24-
if (Schema::hasColumn($model->getTable(), 'reference') && is_null($model->reference)) {
25-
$count = $model::count();
24+
$count = method_exists($model, 'getCounter') ? $model->getCounter() : ($model::count() ?? 0);
2625

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

31-
$model->reference = $reference;
28+
$prefix = method_exists($model, 'referencePrefix') ? $model->referencePrefix() : config('document.prefix');
29+
30+
if (Schema::hasColumn($model->getTable(), $column) && is_null($model->$column)) {
31+
$model->$column = generate_reference($prefix, $count);
3232
}
3333
}
3434
}

app/Providers/BladeServiceProvider.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,28 @@
33
namespace App\Providers;
44

55
use Illuminate\Support\ServiceProvider;
6+
use Illuminate\Support\Facades\Blade;
67

8+
/**
9+
* @todo To create custom Blade Directives using Blade::component
10+
*/
711
class BladeServiceProvider extends ServiceProvider
812
{
913
/**
1014
* Bootstrap services.
11-
*
12-
* @return void
1315
*/
1416
public function boot()
1517
{
1618
\App\Blade\Directives\Icon::register();
19+
20+
// @todo to figure out, how to pass data to the custom component
21+
Blade::component('components.cards.figure', 'figure');
1722
}
1823

1924
/**
2025
* Register services.
21-
*
22-
* @return void
2326
*/
2427
public function register()
2528
{
26-
//
2729
}
2830
}

app/Providers/RouteServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function mapApiRoutes()
6868
protected function mapDatatableRoutes()
6969
{
7070
Route::prefix('api/datatable')
71-
->middleware('datatable')
71+
->middleware('api')
7272
->as('api.datatable.')
7373
->namespace($this->namespace . '\Api\Datatable')
7474
->group(base_path('routes/datatable.php'));

app/Providers/ThemeServiceProvider.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,16 @@
22

33
namespace App\Providers;
44

5-
use Illuminate\Support\Facades\Blade;
65
use Illuminate\Support\ServiceProvider;
7-
use Illuminate\View\Compilers\Concerns\CompilesLayouts;
86
use Illuminate\Support\Str;
7+
use Illuminate\View\Compilers\Concerns\CompilesLayouts;
98

109
class ThemeServiceProvider extends ServiceProvider
1110
{
1211
use CompilesLayouts;
1312

1413
/**
1514
* Bootstrap services.
16-
*
17-
* @return void
1815
*/
1916
public function boot()
2017
{
@@ -23,18 +20,16 @@ public function boot()
2320

2421
/**
2522
* Register services.
26-
*
27-
* @return void
2823
*/
2924
public function register()
3025
{
31-
//
3226
}
3327

3428
/**
3529
* Strip the parentheses from the given expression.
3630
*
37-
* @param string $expression
31+
* @param string $expression
32+
*
3833
* @return string
3934
*/
4035
public function stripParentheses($expression)

0 commit comments

Comments
 (0)