Rating system Laravel - php

IMPORTANT: I'm not asking for the source code to do this, I'm just looking for someone to tell me how to do it and then I'll try by myself to do this.
Hello, I'm a Laravel beginner so I'm sorry if this sound logic to you, here is my question: I need to display review on the profile of my community, I need :
Short text for the review
Rating system between 0 and 5 (star rating)
Date of the review (Month and year)
First name and last name of the reviewer
Count the number of review for a profile
I'm absolutely not looking for the source code to do this, I'm just looking for someone to tell me like 'you have to create a database, put this data in.. etc' etc because I have absolutely no idea where to start to do this.
Once this will be done, I need to display each review of the right profile and make an average of the rating which is from 0 to 5
Thank you and have a nice day/night ! :)

Well you probably will be using a database for convienence. But other methods are available too. What I would do? This is just a single example. This could not suite your environment. This is very global too as your question is.
Create a table called Review
Make some columns: id | rating | text
Create some tables with relationships to the review table
Get some stars input fields in your form
Make some post / get requests

Related

Database structure for saving subgroups in mysql

I made a post a while back and got a lot of comments about how bad my code was. So now im asking you to help me on how do it better. I'm trying to save subgroups in mysql. This is how the subgrouping can look:
Bosses
Minibosses
Wannabe bosses
Denied bosses
Future bosses
Sales
Private
Companies
HR
Support
I might not add them in this order. Say 2017-01-01 i add all but "Denied bosses", and then 2017-02-01 add it. How would you this up in mysql? If you could show me an example at http://sqlfiddle.com/ I would really appreciate it.
Also, how would you go about fetching these results so that I can easily print it in a dropdown? I cant use optgroup in html because i need to be able to press the top groups. The problem lies in displaying them on my site properly
Smart table for your soloution can be like this:
http://sqlfiddle.com/#!9/369172/6/0
:-)
SQL for main groups:
select * from group where parent_id is null;
SQL for subgroup:
select * from group where parent_id = :parentGroupId;

PHP MYSQL Show tracker, how to mark episodes as watched

I am learning PHP the fun way, by making something useful. I'm making a personal PHP/MYSQL website for tracking watched episodes of tv-shows, and it's going quite good so far, albeit messy.
I have a user table, a episode table and an series table. Each of these are self explanatory I guess. What I want to do is make each user in the user table able to track what episodes have been watched. (Each single episode is in the episode table with a field that joins it with the Series table to keep track)
What I cannot get my head around is this:
How can I track if said user has watched said episode?
The only solutions I've come up with is
Add a field in the episodes database with the userID and mark them as 0 or 1, which isn't a very nice solution.
Even worse; each user has a "watched_id" field with several values for each watched episodes.
I know enough to know that this is not a good approach,
how can I approach this more effectively?
You need to create a many-to-many relationship using a mapping table ie. named "watched" with the following fields
id
user_id
episode_id
watched_at
...
Hope that helps. There is a lot of documenteation on the net if your searching for "many-to-many relationship", here is just an example:
http://www.joinfu.com/2005/12/managing-many-to-many-relationships-in-mysql-part-1/

Privacy in simple DB system

I am implementing a simple database system. Basically is a simple social network, everyone has his own dashboard, where you can post some random text. The problem is that I want a privacy level, I mean I want that somebody is allowed to browse only some profiles. And I'm deciding who can watch what.
The question is: How can I do that?I have to work with relation in the database or what?
Thanks for your time.
S.
What you are looking for is called "Access Control List" (ACL): Check out Nettuts tutorial on implementing an ACL: http://net.tutsplus.com/tutorials/php/a-better-login-system/
Create a secondary table where you keep who can access what. If in the main user table you have and id or something (preferably indexed) (like you should). Just make a 2 column table with id and view_id or something (both foreign keys and togeder should form a pk). And... you read from it.
Most probably you would want to set a table for your privacy like
id type
1 View All
2 View None
3 View Something
then on your table where users can be found you could call the type
user_id privacy_id
1 2
2 3
4 1
where privacy_id is the id of your privacy table, something like that.

Thumb rating for wordpress - top user

I am currently using gd star rating (thumb rating) to rate posts (articles - no rating on comments). What I really want to do is show a table of the top 5 users and their number of votes based on the total number of thumbs up they get for all their posts. For instance
| user | No of votes |
If this is not possible with this plugin, is there any other plugin that is capable of such. Or is there a manual way of achieving what I want. I don't mind manual coding with the right nudge.
Many thanks guys
The easiest way to answer your question is to look at the database and see how the plugin is storing the "votes". I don't know that plugin, but it has to track the up/down votes somewhere, either in it's own table, or by adding a column to one of the default WP tables.
Once you track down the table that's tracking the votes, you can write a basic query that returns a limited set of users, ordered by their up/down votes. It'll look something like this:
$wpdb->get_results("SELECT id, name FROM up_down_votes_table ORDER BY what_ever_the_column is named");
The full documentation for querying the database is here.

Quality questionnaire php mysql graphipcs

i'm making a questionnaire about a service quality, its contains the options (poor, regular, good, very good). It's contains 6 questions (radio button) and a suggestion box (textbox).
In the table of the database i created 6 rows for questions, 1 for suggestion and 1 for date (a friend of mine tole me to use this but i didn't get why).
q1) I'm going to atribute a value form 1 to 4 to the radio buttons options, and i'd like to sum every answer for each question, and then divide by the numbers of user that answered that question and give the mean. how am i supposed to to that? I'd also like generate reports of the month, of the year.
q2) not only about the questionnaire but for registration too. I need all the fields to be completed, no blank options, if he don't complete all of fields it'll not be submitted and there will be a warning message to the user.
q3) about the field type, i'd like it to be the same class that is in the database, i'm having a "problem". Ex: Name(varchar) : 1234(int), in the field 'name' of the table of the database 1234 will be shown as name, and i don't want this, i want only the type that i declared in the construction of the table.
q4) i'd also like to know if it's possible to create pizza graphics, about the percentage of each question, is this possible?
q5) I'm using phpmyadmin and some of my id's are auto_increment, but 'cause of my tests they at a high number, i'd like to restart to 0 the ids number, is this possible?
Thanks for the attention.
To me this sounds like what you more need is a complete surveying package. This has been done before and there are many great paid and free options.
If you are attached to a php/mysql answer, a quick search finds this as a nice open source option.
http://www.limesurvey.org/

Categories