generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestions for Improvements #37
Labels
enhancement
New feature or request
Comments
These are some cool ideas! |
Hello @JustSteveKing Sorry forgot one more thing. Pagination One should be able to do something like this if it does not already exist: <?php
declare(strict_types=1);
namespace App\Transporter\Requests\Sour\Posts;
use JustSteveKing\Transporter\Request;
use App\Http\Requests\UpsertPostRequest;
class Post extends Request
{
protected string $method = 'GET';
protected string $path = '/v1/post?page='; //being able to paginate And in my controller I would do something like so: <?php
declare(strict_types=1);
namespace App\Transporter\Requests\Sour\Posts;
class PostController extends Controller
{
public function index($page = 1)
{
$posts = ListPosts::build()->appendPath($page)->send();
if ($posts->status() == 200) {
$posts = $posts->json('payload');
return view('post.index', compact('posts'));
} else {
return redirect()->route('login')->with('error', 'You are not authorized to view this page');
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, @JustSteveKing thank you for this great package once again and also for the quick fixes from yesterday. I was thinking about some ways you could improve the package. Below is an example:
I'm working on an app that consumes solely on an API developed in Laravel, now for crud operations like Post management, I would have to create a Transport Request class for all the crud operations which is how the current package works (I stand to be corrected). I would have wished to just create one class e.g UpsertPosts or PostTransporter which will take care of all the crud operations instead of creating different classes for Create, Read, Update and Delete.
In the end, I would love to be able to do something like this:
Also instead of adding ->withData(['title' => $request->title]), I would like to be able to pass the data instead inside the PostTransporter class to keep things clean maybe via the constructor like so:
NB: So one can define the validation rule via the function above or just import their validation request as I did in the construct
I hope I was able to explain myself well. This would have been super amazing to have. Once again thanks for all the hard work.
The text was updated successfully, but these errors were encountered: