Is there a way I could modify the login form, header or sidebar to apply custom visuals/features ?
I can see that Encore\Admin\Layout\Content renders the view admin::content
Do you know if I can override the view?
Thinking about extending the Content class and override...
Alright! I've found the most clean way I think...
For instance I wanted to override the header.
I've created the folder resources/views/vendor/admin and that's where I will put the same file structure as the package in vendor/encore/laravel-admin/views.
So, for the header, I've copied the file vendor/encore/laravel-admin/views/partials/header.blade.php into vendor/encore/laravel-admin/views/partials/header.blade.php. Then I can modify my copy and it is the file that will be used!
Just found the docs about this feature
https://laravel.com/docs/5.4/packages#views
Use app('view')->prependNamespace('admin', resource_path('views/admin')); to override the bulitin views.
Ok, I did not know this method. Seems to allow deciding a specific folder instead of using resource/views/vendor/admin. Good to know.
"Use app('view')->prependNamespace('admin', resource_path('views/admin')); to override the bulitin views." - Which file we need to use this?
Also is there any way to add custom JS for each field, like on date change [ date of birth, I will calculate age ], tirgger js code?
@oopmvc
I don't know why people simply can't give complete answers, instead spilling a single code line like everybody knows how everything in this project connects and expecting us to magically know where to put it.
Anyway, I managed to find this in the chinese docs, and translated it with Google Translate.
If you need to modify the view yourself, but it is not convenient to directly modify the laravel-admin situation, you can use the following solution
Copy vendor/encore/laravel-admin/views to the project's resources/views/admin and add the code to the app/Admin/bootstrap.php file:
```php
app('view')->prependNamespace('admin', resource_path('views/admin'));
How to customize the form view only for some routes like pages/1/edit ?
@oopmvc
I don't know why people simply can't give complete answers, instead spilling a single code line like everybody knows how everything in this project connects and expecting us to magically know where to put it.Anyway, I managed to find this in the chinese docs, and translated it with Google Translate.
Summary of common problems
Override the built-in view
If you need to modify the view yourself, but it is not convenient to directly modify the
laravel-adminsituation, you can use the following solution
Copyvendor/encore/laravel-admin/viewsto the project'sresources/views/adminand add the code to theapp/Admin/bootstrap.phpfile:app('view')->prependNamespace('admin', resource_path('views/admin'));
Thanks for your tip @leandroeidi, I tested it and it worked, I was able to customize the Login page and the Dashboard overwriting. In this way I managed to version these source codes
In the new folder version this hierarchy worked for me.
app('view')->prependNamespace('admin', resource_path('views/admin/views'));
Most helpful comment
@oopmvc
I don't know why people simply can't give complete answers, instead spilling a single code line like everybody knows how everything in this project connects and expecting us to magically know where to put it.
Anyway, I managed to find this in the chinese docs, and translated it with Google Translate.
Summary of common problems
Override the built-in view
If you need to modify the view yourself, but it is not convenient to directly modify the
laravel-adminsituation, you can use the following solutionCopy
vendor/encore/laravel-admin/viewsto the project'sresources/views/adminand add the code to theapp/Admin/bootstrap.phpfile:```php
app('view')->prependNamespace('admin', resource_path('views/admin'));