Closed dukenst2006 closed 3 years ago
Hi,
Which view do you want to edit ? The overriding system is the Laravel's one, as you can see in the boilerplate service provider. It will use namespace to know which view is overridden, I have to check if I don't forget to use the namespace somewhere.
Thanks for your quick response, i changed the footer view, also i would like to change the users/* views to add new fields.
The path on config/view.php is resource_path('views')
What is the best way to edit and have full control on the views and controllers that comes with the package?
Thanks,
For controllers, the easiest way is to override login routes by setting them in routes/web.php
:
$override = [
'prefix' => config('boilerplate.app.prefix', ''),
'domain' => config('boilerplate.app.domain', ''),
'middleware' => ['web', 'boilerplatelocale'],
'as' => 'boilerplate.',
'namespace' => 'App\Http\Controllers' // < this is the important line
];
Route::group($override, function () {
Route::get('login', ['as' => 'login', 'uses' => 'Auth\LoginController@showLoginForm']);
Route::post('login', ['as' => 'login.post', 'uses' => 'Auth\LoginController@login']);
// Add here the routes you have to override from src/routes/boilerplate.php
});
Will use the methods from app/Http/Controllers
instead of Boilerplate controllers. Views are already overridden by those in resource/views/vendor/boilerplate
Copy the file src/Controllers/Auth/LoginController.php
to app/Http/Controllers/Auth/LoginController.php
. Edit the file to set the new namespace to App\Http\Controllers\Auth
and you can change the methods for your needs.
Don't forget to set your new User model with additional fields in config/boilerplate/auth.php
and config/boilerplate/laratrust.php
Thank you @sebastienheyd, really appreciate your response, keep up the great work. Best,
Hi @sebastienheyd
I did exactly the changes you suggested but after a user has been created i got this issue,
TypeError Sebastienheyd\Boilerplate\Events\UserCreated::__construct(): Argument #1 ($user) must be of type Sebastienheyd\Boilerplate\Models\User, App\Models\User given, called in
any idea ?
You have to extend \Sebastienheyd\Boilerplate\Models\User
instead of App\Models\User
in your model.
Have a look to the new boilerplate:scaffold
artisan command : https://sebastienheyd.github.io/boilerplate/howto/scaffold
Hi @sebastienheyd, Thanks for this great package, I want to customize the views, i run this command :
php artisan vendor:publish --tag=boilerplate-views
to override. and views are onresources/views/vendor/boilerplate
when i edit the views on this folder, changes are not show even i clear cache and view. any idea how to fix that ? Thanks in advance.Best,