I'm working on an application in which I want to use both Laravel and Google BigQuery to store the data.
I want to continue to use Laravel's Eloquent models for easily generating SQL, but I want all the SQL to be sent to Google BigQuery for storing and reading the data.
Is this possible with Laravel?
What is the best way to accomplish this?
Failing to find a library that is already handling this ( You would want something similar to Laravel Scout ) - You could Write a wrapper around the Google BigQuery Service ( with something like this https://github.com/schulzefelix/laravel-bigquery there is other packages available as well ) - With this you would then need to look at writing events off of the Laravel model you want to send to BigQuery https://laravel.com/docs/5.5/eloquent#events if you want to listen for many different events on a given model i would look into using Observers - https://laravel.com/docs/5.5/eloquent#observers
I would start with the above & have a look at https://github.com/laravel/scout for ideas on how you might be able to implement this.
I'm sure the OSS community would be very thankful if you where to package it up as well.
Good luck!
Related
This might seem stupid but I've had this question for a long while. I've been using ORO CRM DB and its API for a while now. Its really one of the good open source CRMs. I just wanted to know if I can use their database and create a Django REST framework around it and create the same functionality of what ORO API is offering.
I would rather build the API with DRF than learn PHP to get the functionality that I need. So is this question. Kindly help me in figuring this out. Thanks in advance.
TL;DR
Yes for read, but using application database is a bad practice.
Explanation.
In Oro codebase there is a lot of triggers (listeners, queue message emitters) that could be fired during the CRUD operations, you can't use another code base to just mimic it.
Actually you can try to use DRF for read operation, that is rarely trigger any events, but doing this (use external db that is tend to change) is a bad practice.
You can try to explain your use case to get more context of what you are trying to achieve.
Hello guys I need help here,
I want to send PDF mails to users on a monthly basics. but the PDF will have values from the db. so each users has a different content from another user all taking values from db. If i can't achieve this perfectly on Laravel I need another language that can help me achieve this thanks.
$schedule->command('custom:command')
->monthly();
You can achieve anything in Laravel which you can achieve in PHP :) and as far as web development is concerned, you can achieve anything in PHP :)
However, I am not sure what exactly is your question about so I will answer all aspects of sending an email with dynamic pdf.
Get fillable PDF
First of all, you need fillable fields in your pdf in order to generate a dynamic pdf in run time. If you dont have fillable fields in your pdf, you can create them using any online tool. One example is: https://www.pdfescape.com/
You can also use Adobe to do so if you like.
Create a PDF with dynamic data
Once you have your empty, fillable PDF, then you can populate the data in it using PDFTK library. Of course, you will have to install this tool in your Server in order to use it.
I recommend using it directly, running exec or similar commands in PHP. However, if you are not comfortable, you can use various Pdftk wrapper, available in Laravel. One example is: https://github.com/mikehaertl/php-pdftk
I myself prefer using exec directly from PHP. Here is a REALLY GOOD tutorial for that: https://www.sitepoint.com/filling-pdf-forms-pdftk-php/
Send the email
Well once you have your PDF generated and saved on Server, all you need to do is attach it with your email and send. You can find all about attachments in Laravel here: https://laravel.com/docs/5.1/mail#attachments
Run it via cron
If you have to do it on a regular basis. I advise you create a cron on your Server. There are various ways to do that. I advise you do it via cPanel, if you have one on your server of course as it provides very user-friendly way of creating crons. If not, you can also use terminal to edit the cron files in Linux Server.
I do not recommend using Laravel inbuild scheduler because it has known issues.
Well that's it, voila..that's the whole process of sending dynamically generated PDFs via email on regular basis.
Good luck!
I want to use a chart package to create a chart using real time data from my database. I tried a package.The link i am providing bellow.But i am not successful.Can anyone provide me a full tutorial about this ?
https://charts.erik.cat/getting_started.html#screenshots
If you want to use charts in your laravel app, I believe you will need to do this in blade view (frontend)
Here are very good JS chat libraries with good documentation
I am currently using
https://www.chartjs.org/
Another good one
http://morrisjs.github.io/morris.js/
Chart solely for laravel http://lavacharts.com
Check these examples on adminlte
https://adminlte.io/themes/AdminLTE/pages/charts/chartjs.html
Another thing, you will need to learn how to use their API. This is universal, everyone has to learn. However, there are a lot of examples you could extract and use as a baseline.
Hope This helped you.
Good Day, I am currently building a simple CRUD application using Laravel 5.5, and I want My "LIST" to be updated in Realtime whenever the user create a record or update a record . Ive Done some research about Events and Listeners, Broadcasting, Socket IO, and Vue JS, but still I cant find the right technique to do it . What recommended technology is the best for this Feature? Can somebody Explain to me how to do it ? Thanks in advance ..
I have a Laravel backend which basically works as an API and dashboard for my database and its data. The data updated daily using a Python script directly to the database. Is there any way to trigger a Laravel Scout update (so that the row is updated in Algolia as well) outside the PHP project?
The only alternative I thought was to use a Laravel api to handle the changes between the python script and the database so that only Laravel can communicate directly to the database.
However, I would really prefer if there was a way to add a listener or whatever to that without using Laravel in between since the python script is REALLY fast.
There are two ways for that:
1). You can use Laravel API to update Algolia entries into database.
2). Maybe you can use Algolia Python Library.
I suggest you to use Laravel API. You can simply call API URL from Python Script. You need to write clear PHP code of Laravel controller API, because python is fast and it will need to communicate fast with api.
Also: You can simply use Python module named flask to connect to your laravel database and make changes what you want in database. (Every database can be managed from different programming languages such as PHP, Ruby on Rails, Python and etc.)
Only laravel can't communicate to your database, it can be done from Python too (But of course it's mainly possible from laravel too).
If you want to reindex everything, which seems to be the best way for you, I would just execute php path/to/artisan scout:import "App\Model" via Python.
If you want to update each model, because you will only edit a very limited number, like Giorgi said, I would use the Algolia Python client and call Algolia's API directly. It should be very easy to write.
https://github.com/algolia/algoliasearch-client-python