Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have this Advanced Programming assignment building an e-commerce website. I am using Laravel 6. However, the assignment states that the server must be independent of the client, therefore I cannot use blade. Instead all the client-side must only comprise HTML5, CSS and Javascript. How can I go about linking my backend with my frontend? I have tried searching online for an answer but since I'm very new to Laravel, I don't quite understand how to go about this. Could you guys point me the right direction?
What your assignment is asking is to create a restless backend API and frontend to consume it. When you are going to access your site you will be contacting the frontend and then the frontend is going to retrieve what info it needs from the backend and display them to you. Usually, the backend and frontend run on different servers (eg a php server for the backend and node.js for the frontend) but this isn't always the case.
Basically he wants two separate projects the backend and the frontend.
The frontend can be created by using just html-css-javascript or by using react.js, vue.js or any other library for building ui's.
In both cases you will use ajax call to get the info from your backend (in your case the laravel app) to the frontend.
Check this tutorial for building a backend api with laravel.
Check this tutorial for consuming api in html.
Check this tutorial for consuming api with vue.js
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a project and using angular as front end and PHP as back end, installed both in different domains, PHP project is complete and working. I have created API in PHP and in angular I will call that API.
can I do like copy PHP project into angular src folder and run or using different domains how can I call API Or how?
what is the most used way for doing this I have seen tutorials over this but not able to get it correctly?
so can you please tell me any way to work,please give me your suggestion and thoughts
This is quite a big question really.
No-one will be able to give you an answer as to how to do what you're trying to achieve in a single stackoverflow post. It's like asking "how do I build a car?" - there are many steps involved to complete this process. Your best bet is to follow a tutorial.
In my experience, having separate applications for front end and backend is quite common.
You should keep your PHP project separate to your Angular project instead of mixing them.
You should follow a tutorial on how to build a full stack application such as these:
https://morioh.com/p/f2ad5d91a8dd
https://phpenthusiast.com/blog/develop-angular-php-app-getting-the-list-of-items
https://www.techiediaries.com/angular/angular-9-php-mysql-database/
Good luck!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am battling with myself about the use of Laravel 5 AND / OR NodeJS.
I want to build a webshop where other webshops or stores can sell their products on. NodeJS drops in when a visitor is viewing an auction page and a product has a new bid. It should be visible without refreshing the (product)page. The rest of the website won't need this functionality.
So, 2 backend environments are awkward, right? So should I pick NodeJS, Laravel 5 or should I just use both for this page only?
You can use both of them. their architecture and nature is different. Laravel is a framework with php language that runs per request but node.js is a platform that is best suitable for streaming and realtime. If you want a CMS like website then I suggest Laravel because Development cost and maitenance is better, due to its active community. If you developed that with Laravel, then you can use push notifications to inform your users from new changes or you can use methods like long pulling.
I don't know about Laravel which is a PHP framework but whatever you want to achieve can be achieved using node js with socket io support. You can have realtime updates using socket io. Please check it out. No need to have two frameworks of different language platforms to achieve a single task. And it is wrong to compare socket io(event based communication engine) to Laravel (php web application framwork).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have just fineshed an apprenticeship in a little company for which I have developed management web application hosted in ARUBA together with mysql DB. Now for my "Mobile application" course I would like to realize an iOS app as a mobile version for that web application: pratically I could create a new frontend as an iOS app. I am supposed to use Swift and I am totally new to iOS development. So I would like to ask if you can give me some tutorials about how to use swift and php to connect to a database and perform CRUD operations. Before suggesting this idea to my teacher I would like to make some practice and see if I am able to create this kind of app.
What do you say?
This course looks promising, though I haven't done it myself, so I'm not sure.
Think of this project in three parts:
Creating your MySQL database
Developing your PHP API to "talk to" the database - this is the mediator between the client and the database
Developing the client code
It sounds like you've done some web development, so can I assume that you know how to do number 1 and 2 above? You can create the PHP almost exactly like you would for a website, and it has a great function (json_encode) to put everything you're sending to the client in JSON. There is a class called NSJSONSerialization to deal with the JSON received on the client end.
Do know that this is a big project; developing all the PHP and Swift code in addition to the database is no small feat.
To accomplish number 3, I would recommend reading up on NSURLSession. This tutorial and this tutorial may be useful.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How does a Laravel web application serve both a web-based front-end and native mobile app?
Suppose for the web front-end we use a JS framework like AngularJS. Would the Laravel application consist of one API to serve both clients (web and native mobile)? Or would it be better to decouple these in some way and create two distinct APIs? Assuming the response will be JSON in this scenario, what would be the role of Laravel Views?
How would the Laravel application differ if the web front-end is based on Blade templates, while the mobile application relies on JSON?
The app would have multiple route groups, the standard desktop site at / and then an API at /api/v* that is used by the mobile app and eventually by some Javascript code in the desktop site (for example a search function that loads results via AJAX).
In case of an API, there's no need for views, your controllers directly return JSON responses with Response::json() - and in some cases Laravel automatically takes care of that, for example you can directly return an instance of a model and the framework will automatically serialize it into JSON.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
My team is going to make application in android having quizzes on mobile whose questions,options would be entered from my website. I want to be able to enable the new quiz from website end.
Going to code website in PHP. I'm good at wordpress so just wondering if I can do this in that only or not as I don't in what form I have to convert my data so that android can get it and use it in "native app"(not browser!!).
my job is only the website part I know how to make pages but don't know in what form I have to give quiz data and how to control enabling and disabling the quiz in mobile app
thanks for the help in advance...
There are several ways you can transfer data through different applications/technology.
Some ways that appear to be straight ahead to me:
The Android App can parse your generated HTML file directly and extract the questions and the options parsing the HTML tags.
The Android App can also connect to your website DB and get the information directly from that.
You can also expose your data creating a services using WebServices or ODATA, for example.
I have to say I've only ever dealt with Cordova for writing apps but if Cordova can do it...
In the app I wrote for an internal application I used an AJAX call (Cordova uses JS + HTML as its interface). My PHP server then returned a response my app could use (in my case, JSON) It sounds like this is what you want to know. Now your app team will have to tell you what format to send your response but it's possible to have apps do this.
This would have to be done in PHP(EDIT: or any other technology as such) since your team is working in PHP already. To enable/disable the "new quiz", the app would have to query the server for this information, which would come from the Database.