A new folder should be added under the
/public
folder in the project root directory. For example, let's say we add the 4th template. folder as follows:
/public/userFrontend_4/assets
All style files, including css and js, and img files of your template should be under this folder structure.
A folder structure must be created again under
/resource/view
.
Let's name this folder
userFrontend_4
.
Let's create two more folders under
/resource/view/userFrontend_4
and name
them
layout
and
pages
.
Layout.blade should be created under the
/layout
folder and the common parts of our
HTML
codes should be placed in this blade.
For example:
It should be placed into this structure along with the necessary codes.
Let's add the following codes between the
< head > head >
tags in layout.blade.
And
Let's add the following code below all the css codes.
@yield('css')
Let's add the
@yield('content')
code to
< body >
",
after
< header >
, that is, to its content,
and at the end, let's add the following code to the bottom of all script files but
inside
< / body >
:
@yield('js')
After creating
userFrontend4Index.blade
in
/pages
, let's take the codes between
< header >< /header >< footer >< /footer >
here.
In this way, you will import your template.
To make it dynamic, you can make it dynamic by looking at other userTemplate
codes and placing them in the required field. Take reference from the previously written codes.
Now let's move to the user side and let the user select this template.
You must perform the operations in
/resource/view/user/pages/userConfig.blade
.
By following the html and php codes in the
< form >
here, copying and pasting the html codes for the 4th template you added,
giving value="4"
and creating the template photo, saving the photo in a required
field under /public/userFrontend_4/assets
and then .blade
By defining it in
you will complete the user template selection process here.
As the last step, you need to proceed with the operations on the controller side.
For this, the following piece of code should be added in addition to the codes at the bottom of the
userFrontendIndex
method in /app/Http/Controllers/UserFrontend/UserFrontendController
.
elseif ($data['user']->template == 4) {
return view('userFrontend_4.pages.userFrontend4Index', $data);
}
By following these steps, you can add the templates
you want to add in this way and reference the existing ones and make them dynamic.