A
A
Alexey Lyumanov2017-04-19 11:41:27
Laravel
Alexey Lyumanov, 2017-04-19 11:41:27

How to properly space functions in laravel 5.4?

The question relates rather not to OOP, but more to the logic of perception and interaction.
If we talk about the fact that asistan immediately creates a controller in the full rest style, then the question arises how to work with this.
In any case, you need an admin panel to manage content. And in the admin panel, anyone needs the same functions as in the output.
It turns out that you need to duplicate the code? Or is it possible to get away with some kind of one check?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mokhirjon Naimov, 2017-05-01
@zvermafia

It turns out that you need to duplicate the code?

To avoid code duplication, you can create your own helpers (as a function), services and packages, or you can also use traits ...
PS If asistan is artisan, then it creates RESTful controllers only with the --resource option. I.e
php artisan make:controller SomeController --resource

And the code below will create a regular class inherited from "App\Http\Controllers\Controller":
php artisan make:controller SomeController

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question