Laravel Debugbar with laravel api routes - laravel

I have a Laravel API.
The front end application is completely separate from Laravel.
All Laravel routes are located in routes/api.php
Is there any way to make the Laravel Debugbar work in this case?
https://github.com/barryvdh/laravel-debugbar

barryvdh/laravel-debugbar needs to be installed on your Laravel project (actually all debuggers need to be present within the project to audit every request) and get its files served to the frontend to work (edit repsonses with Middleware/InjectDebugbar.php).
I won't say that it is impossible to get its insights on a separate front, who knows if you are ready to fork the project and communicate with the debug bar APIs.
For a simpler alternatives you can use:
laravel/telescope docs repo
Clockwork browser extension website repo
spatie/laravel-ray(paid) website docs

Related

How do i set up laravel as an backend api for nuxtjs

I've starterd working on a project based of a template i found on github. This template includes laravel, nuxtjs and vuetify. In this template laravel serves as a backend api for my nuxtjs project; Which is what i need.
The github repo: https://github.com/BakayYank/laravel-nuxt-vuetify
But what i dont like about this template is that the package.json file is filled with dependencies of which i dont know what they do or even if i need them.
I want to make my own project with laravel and nuxt but i don't know how to make laravel an api or how to send data to this api.
If anyone could help me understand or provide me a source that would really be appreciated.
This course teaches that beautifully if you are willing to pay for a month (It's totally worth it!). Laravel Api/NUXT Frontend Course
Otherwise, you would build the laravel app as normal but don't use blade views. Then in NUXT send data using ajax requests. If you have any other questions let me know! I hope that helps!

Intergrate Laravel Library in Codeigniter Project

I have one library in laravel :-
https://github.com/mjaschen/collmex
I want to integrate it in my Codeigniter project, Can anyone help me in it?
since both use composer, you can simply require it.
but since you can't use service providers...you have to call them manually (i.e. you won't get access to alias in laravel) except that...you can do everything as in laravel project.

Vue and Laravel separate app - Need feedback on architecture

I need a bit of expert feedback on this please as I do not want to start my project in the wrong way.
I would like to keep my Vue code separated from Laravel, the reason being, I may use this vue app later on on Cordova.
First question:
I understand how to host the Laravel API and Vue app on 2 different domains, no problems at all but I am unsure on how to setup the folder when both apps are on the same domain.
I know that Laravel should be hosted below the public_html folder and have a symlink to the public folder for security purpose. But where should my vue app goes?
Second question:
When I save images from Vue(as I am creating a blog) the images are going to the Laravel store/images folder, so each time I want to show an article in my vue app, the API must each time request the content(text and images) from the Laravel API, is this fine? Will the Google bot be able to trigger the API request when requesting the content?(I actually never thought of this...)
Thank you so much!

How to include complex Vue app inside Laravel

I have a Laravel project, which should contain different Vue apps.
Some of these apps are quite-complex (stand-alone app.js file with its own components).
How can Laravel manage different vue apps, each one with its own app.js file and components?
One approach to solve this problem is to write vue apps as SEPARATE projects (using only frontend technologies) which connect with laravel using RESTful API.
This is in fact simple micro-services architecture (which include the hard separation between frontend and backend code). If you decide to do it, you will face CORS problem (but don't worry - you will find many solutions on internet e.g. this) because the vue app will be on different domain/subdomain that your RESTful laravel API.
Laravel support create restful API controllers - cmd:
php artisan make:controller API/MovieController --api --model=Movie
routing routes/api.php:
Route::group(['prefix'=>'v1'], function() {
Route::apiResource('movies', 'API\MovieController');
...
});
It is good to use for api authentication Laravel Passport (oauth2)
You should also build your separate vue applications using some modern frontend technologies like webpack, nmp (here is some example but you will probably find better)... long story - but this is good direction :)

Use same database for 2 Laravel Apps

I am making a web app on Laravel 5.3 which is frontend app. I am managing data from a Backend App. I have already made models and migrations in the frontend app and not in the backend app. So how should I use same database, models and migrations for both. Please help.
You can just create the models in the backend app and they will still work.
If you are using Artisan:
php artisan make:model ModelName
Migration files can be a little more tricky, I would suggest just managing all of this through your frontend app for consistency and then creating the models you need in the backend app.
You didn't mention if your backend app is also using Laravel.
Either way, I think your best approach would be to structure the backend app as an API. Then it would contain the database migrations and models. The back end would be the one to connect directly with the database. The front end would then fetch the data from the back end API and display them. The front end app could then have its own models too (but not database models).
There are arguments to support both using an API on the front-end app to access the backend or just recreating the models on each system. I'm supporting multiple sites which access the same data. It soon became apparent that the best way was to create an API on the backend to service them all. Also worked for other shared resources i.e. images.
There is a slight penalty in the load times but is so small it isnt worth noting. It also helped when using other platforms i.e. ioS, android and Ajax.
You can rename the migrations table in your bootstrap/app.php like this:
$app->configure('database');
$app->config->set('database.migrations', 'backend_migrations');
That way you will get two migration tables, one for the frontend, and one for the backend all in the same database.

Resources