pickab00

pickab00

Member Since 1 Year Ago

Experience Points
10,820
Total
Experience

4,180 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
2
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 3
10,820 XP
Oct
05
2 weeks ago
Activity icon

Replied to Calling Method In Model As An API Call

Genius. This works great. Thank you so so much!

And also thank you for the shortened version of my code :)

Activity icon

Replied to Calling Method In Model As An API Call

Hi, I am getting "Call to undefined relationship [opened] on model [App\Restaurant]." error. When I use protected $with = [ 'opened' ];

Activity icon

Started a new Conversation Calling Method In Model As An API Call

So I have a custom method which checks if the restaurant is open or not. Now I have implemented it in laravel successfully by doing something like @if($restaurant->opened()) which returns a true else it returns a false. Now how can I do the same and apply this on to an API return inside of a json.

Here is my method:

public function opened(){
       
        $today = Carbon::today()->format('l');
        $today_exists = $this->timings()->where('day', $today)->exists();
        $current_time = Carbon::now()->format('H:i');

        if ($today_exists){
            $todays_timings = $this->timings()->where('day', $today)->first();
            if ($current_time > $todays_timings->open_time && $current_time < $todays_timings->close_time){
                return true;
            }
        }

    }

It's a big mess but basically it returns true or false. And in my API I am doing this:

//Simply
$restaurant = Restaurant::where('active', 1)->latest()->get();

So I am expecting a json which would return all the restaurants which meets the condition. Now how can I apply something like restaurant_open: 1 or something in my json return with the above method in my model

Sep
30
3 weeks ago
Activity icon

Started a new Conversation Laravel Passport Login And Regsiter

I am still new to understanding API's and laravel passport and here is an example of login and register using laravel passport.

public function register(Request $request){
        $validatedUser = $request->validate([
            'name' => 'required|max:55',
            'email' => 'required|email|unique:users',
            'password' => 'required|confirmed',
        ]);

        $validatedUser['password'] = bcrypt($request->password);

        $user = User::create($validatedUser);

        $accessToken = $user->createToken('authToken')->accessToken;

        return response(['user' => $user, 'access_token' => $accessToken]);

    }

    public function login(Request $request){

        $loginData = $request->validate([
            'email' => 'required|email',
            'password' => 'required',
        ]);

        if (!auth()->attempt($loginData)){
            return response(['message' => 'Invalid Credentials']);
        }

        $accessToken = auth()->user()->createToken('authToken')->accessToken;
        
        return response()->json([
            'user' => auth()->user(),
            'access_token' => $accessToken
        ]);

    }

So bascally I am creating a token every time the new user registers. And I am doing the same thing on login. I am creating a new token every time the user logs in to their account. I was wondering if this was the right way to do it. I mean creating a new token every time the user logs in. Shouldn't it be that the user has a token when registering and the login checks if the token exists and checks if the registered initial token is the same and not expired? Did I do this right is the question.

It would be great if someone could suggest some improvements if needed.

Activity icon

Replied to Help With Understanding Laravel Passport

Got it. Thank you so much!

Activity icon

Replied to Help With Understanding Laravel Passport

I think I got it. I am using axios. So just pass in the authorization header with token and passport will do the rest correct?

Activity icon

Replied to Help With Understanding Laravel Passport

This helped! One very tiny thing though. Could you perhaps give an example of setting the header on a sample route I want the user to be authenticated on?

Lets assume its this route:

Route::get(‘/meals’, ‘[email protected]’)

How would I add the header on to that route.

Once again. Thanks a bunch!

Activity icon

Replied to Help With Understanding Laravel Passport

So I just need to pass in that token once. When the user logs in. After they are logged in, I can access the auth() until the token expires correct?

Does this mean that I will have to pass the token with every api request or is it just a one time thing until the toke expires?

Sep
29
3 weeks ago
Activity icon

Replied to Help With Understanding Laravel Passport

Thats where I have confusion. Simply add the access token for the user to all authenticated routes. Thats what I do not understand. Perhaps an example would point me to the right direction. Do you mean to send token of user everytime i make an api request?

Activity icon

Started a new Conversation Help With Understanding Laravel Passport

I am developing a mobile app and I have just read about laravel passport. It seems to work Like a charm. I can use it to login/register. That is exactly what I want. But what I cant seem to wrap my head around is, will I still be able to call the Auth::user() after I login with passport on my mobile app? I saw a video https://youtu.be/OJtGeqgXwfo which amazingly explains how to do register and login with passport.

My question is this. I understand the basics of how Auth works on web browsers. It uses sessions and so on. But I can not understand token based auth and how it differs from web. And how it works at all as a matter of fact. Also most importantly, as per the tutorial I linked above, will I still be able to use Auth::user() after I login using passport on my mobile app? If not, how would I do that and how does it work.

Im sorry I sound like a complete newbie. Its because I am as I really am having a hard time understanding the concept

Sep
25
3 weeks ago
Activity icon

Replied to Help With A Model Function

For anyone looking, fixed the issue. Used the exists() method. Here:

    $today = Carbon::today()->format('l');
    $today_exists = $this->timings()->where('day', $today)->exists();

Now it will return true if it exists. Else false. Then I did the rest of the conditions from there on:

if ($today_exists){
            $todays_timings = $this->timings()->where('day', $today)->first();
            if ($current_time > $todays_timings->open_time && $current_time < $todays_timings->close_time){
                return true;
            }
        }

Hope this helps for someone looking

Activity icon

Replied to Help With A Model Function

Nothing happens. It just returns false

Activity icon

Started a new Conversation Help With A Model Function

So I have a function in my model which I am calling from somewhere else in my project. The problem is that I can not seem to get the scope right. Here is the code:

public function opened(){

        foreach ($this->timings() as $timings){
            if ($timings->day == "Wednesday"){
                return true;
            }else{
                return false;
            }
        }

    }

So basically I want to return true if it is true and return false if it is false. But it does not seem to be working. I have many timings in my model. So i am looping through and trying to find if the day exists. If it does, then return true else return false. I will do some other things if the return is true but for now, I can not seem to make this work. In my blade I am looping through my model and doing this foreach

{{$restaurants->opened()}}

If I use return "something" then it returns something. that works. Is it an issue with scope? How can I fix this?

Sep
24
4 weeks ago
Activity icon

Replied to Adding/Looping Multiple Images

I should have mentioned this earlier. I have already tried that unfortunately I get Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files. error. Here is the updated code:


if ($file = $request->file('image')[$index]){

                $ext = $file->getClientOriginalExtension();

                $rename = Uuid::uuid4() . '.' . $ext;

                $imageInput = Image::make($file);

                $imageInput->fit(1500, 1000)->save('images/items/'.$rename, 100);

                $insert->image = $rename;
            }

Activity icon

Started a new Conversation Adding/Looping Multiple Images

This question is a bit broad but here is what I am dealing with.

The thing is that I have multiple data insertion inputs. Something like <input name="name[]" /> which I am using to loop from multiple name[] from controller and adding each to a table. The problem is that I have multiple images and I do not know how I could use the same method to add images. Here is my current code:

//This is for the <input name="name[]" />
foreach ($request->name as $index => $ItemName) {

        $insert = new Item;

        $insert->price = $request->price[$index];

        //This part is confusing for me. How do I do the same as above?
        if ($file = $request->file('image')){

            $ext = $file->getClientOriginalExtension();

            $rename = Uuid::uuid4() . '.' . $ext;

            $imageInput = Image::make($file);

            $imageInput->fit(1500, 1000)->save('images/items/'.$rename, 100);

            $insert->image = $rename;
        }

        //Again, <input type="checkbox" name="active[]" value="1" />
        $insert->active = $request->active[$index];

        $insert->save();


    }

Edit: in my html the image file is like this

<input type="file" name="image[]" />
Aug
29
1 month ago
Activity icon

Replied to Help With Shopping Cart

I understand. I will try some ajax hackery for now to pass values. I already have a good idea of how to setup the tables and all. Will leave an update here as soon as I am done. But thanks for the help guys!

Activity icon

Replied to Help With Shopping Cart

That I do understand but when will I create a basket? I mean when the user taps a table, should I create a basket then? And start adding items to that basket using a pivot table? Where should I initialize the basket and how will I later on call the basket by ID when I want to add data?

Activity icon

Started a new Conversation Help With Shopping Cart

So basically I am trying to understand a logic which has to do with a shopping cart. Or more accurately, a shopping basket because it has to do with food items. Its for a restaurant. The basic Idea is for the users to be able to add to basket with an amount. The basket will be a temporary storage. So I was thinking. What relationships should I use and how should I store the data? I already have a item table. And a tables table. Now I want each table to have a basket (which is temporary until user places order) and the basket will contain the items, and its details when the user adds an item to basket. This part is the one I am having difficulty understanding. Do I have to add all the items to the basket with the table id? If thats the case, how will I differ from previously entered data from another user on that table? Do I have to have other tables? And what relationships would I need? Thanks

Aug
27
1 month ago
Activity icon

Replied to Diff In Days On Eloquent

Yeah I tried and I was not able to access it. Anyways, Thanks a bunch for this! This is exactly what I needed!

Activity icon

Replied to Diff In Days On Eloquent

No what I mean is in this code

$result = Tracker::where('customer', 'LIKE', "%$request->customer_name%")->with(['products' => function($q){
            
     $q->where(/*compare here*/)->get();

}])->get();

How would I use the accessor in there to compare the difference

Activity icon

Replied to Diff In Days On Eloquent

This is going to sound a bit stupid but how would I use this

Activity icon

Started a new Conversation Diff In Days On Eloquent

I want to do diffInDays like on carbon but on a query I am running. Here is an example:

Carbon::parse($products->warranty_expiry_date)->diffInDays() < 10

Now here is my query:

$result = Tracker::where('customer', 'LIKE', "%$request->customer_name%")->with(['products' => function($q){

    //Where the same query as above
        $q->get();

        }])->get();

How can I achieve this

Activity icon

Replied to Help With Multi Language

Huh. I never actually thought of that. Stupid of me. I will have this checked. Thanks for the suggestion

Activity icon

Started a new Conversation Help With Multi Language

I am using laravel and I wanted to make an app multilingual. I know I could use locale but I was looking more of another approach. I was thinking of something like this.

Basically having a table called "Languages" and that will contain the language code. Now Imagine that I am having an "Articles" table which I want each articles translation to be. I can't wrap my head around how I could setup my tables and such. Do I store default language data (en) in Article and create another table which will hold the translations? Something like, suppose I am adding an Article. It gets stored in the articles table in English. And there is another table named translations which contains language_id and article_id which will link the article I added to each language. Is this the right approach? I would really appreciate if someone could give me an idea of how to get started. I don't want to use a package.

PS. when the user is adding an article, there are multiple fields for each language. That is how the translation comes in. It is not automatic. The user types in in different languages

Aug
21
2 months ago
Activity icon

Replied to Adding Data With The Same Name

Thank you! This worked!

Activity icon

Started a new Conversation Adding Data With The Same Name

I know this question has been asked a lot but I can not seem to wrap my head around this. Basically I have more than one Item which belongs to a table and I am doing something like this:

    <label for='fname' class='col-sm-3 text-right control-label col-form-label'>Product</label>
        <div class='col-sm-9'>
            <input type='text' name='product_name[]' class='form-control' placeholder='Enter Product Name (YeaLink)' required>
            <input type='text' name='product_model' class='form-control' placeholder='Enter Product Model (T23G)' required>
            <input type='text' name='warranty_period' class='form-control' placeholder='Enter Warranty Period' required>
            <input type='date' name='warranty_date' class='form-control' required>
            <input type='date' name='warranty_expiry_date' class='form-control' required>
            <textarea name='serial_number' class='form-control' placeholder='Enter the serial Numbers in an array with comma separators'></textarea>
        </div>
</div>

So what Happens here is that I have multiple of the above code which comes dynamically from JQuery. When A user click add button, it adds more of the above code (as it is). And I wanted to input all that data to the table with loop. I am using loop to do something like this in controller:

foreach ($request->product_name as $pName) {
            
                $product = new Product;

                $product->tracker_id = $tracker->id;
                $product->product_name = $pName;
              

                $product->save();
                
        }

So I am looping product_model[] in controller and I can add this with no problems. But what about the rest of the input fields? How can I add those?

Aug
15
2 months ago
Activity icon

Replied to Counting 'as' In Laravel

Hi. It doesn't work. I am still getting the error

Aug
14
2 months ago
Activity icon

Replied to Counting 'as' In Laravel

Hi. I am getting

"Method Illuminate\Database\Query\Builder::comments.commentsLikes does not exist."

Also, I renamed commentLikes to commentsLikes because one already exists in my Model

Activity icon

Started a new Conversation Counting 'as' In Laravel

I want to count my pivot relationship but I have a where condition which I need to run and I am not sure how to do that. Here is the code.

$comments = Article::with(['comments.replies' => function($q){
        $q->where('approved', 1)->get(); //this bit works as intended. not the issue
    }])->with(['comments.commentlikes' => function($q){
        $q->where('like', 1)->where('commentlikes_type', 'App\Comment')->count(); //here is the issue
    }])->findOrFail($id);

The issue is where it says, comments.commentlikes. Can I do a withCount and do a where condition? The thing is that I am foreach looping (not on laravel but this is an API call to another application). So basically I want to display the comments and its replies which is working fine. But I want to display the count of likes and dislikes for each comment/reply as well. My commentlikes page is like this:

id
commentlikeable_id
commentlikeable_type
like
dislike
ip

So I have a like and dislike on the table. If a user likes a comment, the commentable_type becomes App\Comment and if it is a reply it becomes App\Reply with like 1 or dislike 1 depending on if it is a like or dislike. So what I want to do is, have a count foreach of my likes and dislikes when I iterate through the data. Something like this

//This is the first comment and its likes with its replies and replies likes and dislikes

comment1: likes count 2
comment1: dislikes count 5

  reply1: likes count 2
  reply1: dislikes count 0

  reply2: likes count 0
  reply2: dislikes count 2


//This is the second comment and its likes with its replies and replies likes and dislikes

comment2: likes count 1
comment2: dislikes count 0

  reply1: likes count 4
  reply1: dislikes count 3

  reply2: likes count 2
  reply2: dislikes count 5

I didn't know how else to explain that. Basically that's what I want to iterate and how I want it to look like

Jul
29
2 months ago
Activity icon

Replied to Writing A Policy For Voting Poll

I want to refractor my code and just use policies instead of messing up my controller with different comparisons. Ill try this and let you know. Thanks

Activity icon

Replied to Writing A Policy For Voting Poll

I don't want user model. I just want to check if the poll and poll id option poll_id is the same. How can I do it

Activity icon

Replied to Writing A Policy For Voting Poll

Hi,

I am still having the issue. The updated version is as follows,

//This is the Policy
public function __construct()
{



}

public function vote($poll_id, $option_poll_id){

    return $poll_id == $option_poll_id;
}

And here is the controller,

$vote_options_test = PollOption::findOrFail($request->voteoptions);

    $this->authorize('vote', $id, $vote_options_test->poll_id);

I am finding the vote option first as I want only one result. And then I am passing that vote options poll_id to the policy. Yet I am still getting 403 unauthorized. $this->authorize('vote', $id, $vote_options_test->poll_id); the $id is the id of the vote. and $vote_options_test->poll_id is the poll_id of the poll option selected by the user. and from there on, inside the policy, return true if $poll_id == $option_poll_id. But unauthorized meaning it is returning false correct? There must be something else wrong here which I am not quite understanding what it is though.

Thanks

Activity icon

Started a new Conversation Writing A Policy For Voting Poll

So I am getting started with policies and I am having a bit of difficulty understanding it. Here is my policy

public function vote(Poll $poll, PollOption $option){

    return $option->poll_id == $poll->id;
    
    }

and in my controller

$this->authorize('vote', $id, $request->voteoptions);

But I am getting 403 error. The thing is there are radio buttons in my blade with the name=voteoptions. So what I want to actually do is check if the vote option belongs to the vote id the person is voting for. Vote options each has vote_id tied to it so I am trying to check if the vote option belongs to vote id. What am I doing wrong? Isn't this $this->authorize('vote', $id, $request->voteoptions); passing the variables to the policy?

Jul
25
2 months ago
Activity icon

Replied to Difference Between Gates And Middleware

Both answers were great. Confusion resolved. Thanks guys. Should have done more research before posting

Activity icon

Started a new Conversation Difference Between Gates And Middleware

So Ive read this article about gates/policies

https://www.google.com/amp/s/appdividend.com/amp/2017/12/13/laravel-gates-tutorial-example-scratch/

And My question was, whats the difference between writing a middleware and gates. In this scenario, I could have used a middleware to block the user from accessing route correct? Can someone please show me other cases used for gates instead of middleware?

Jun
19
4 months ago
Activity icon

Replied to Requested An Insecure XMLHttpRequest Endpoint

@SNAPEY - @SNAPEY - Not local. I’m on cloudways hosting and I do not think its behind a proxy. What if it was on proxy? What are the changes I have to make and what could be causing this?

Also I forgot to update on this issue. I have another function similar to this one which does not return this error and returns 404 error with no issues. There is nothing different except I didn’t include the csrf header in that function ajax setup. I tried to do it that way with the function I am having issues with and replicate it the same way as the working one but no luck.

I do not understand why this would happen on some functions while the other has no issues. It is using https while the ajax function with the issue uses http when an error hits. Normal data (when there is no error) is working on https with no issues on all ajax calls

Jun
18
4 months ago
Activity icon

Replied to Requested An Insecure XMLHttpRequest Endpoint

@SNAPEY - Why is it forcing errors to be displayed on http? My data is on https which I am getting fine but a "on purpose" 404 or 500 error shows the url with http://

Activity icon

Replied to Requested An Insecure XMLHttpRequest Endpoint

@SNAPEY - It returns "failed to load response data". Two are there. Ones status is "canceled" and the other is "blocked:mixed-content". No redirects. Type xhr. The canceled is from jquery.

Activity icon

Started a new Conversation Requested An Insecure XMLHttpRequest Endpoint

I am using ajax to make a request and I do not understand the error. I mean I know what it is But here is my situation.

I am doing an ajax request to fetch some stuff off of the controller and it works fine if there is no error. The requested an insecure XMLHttpRequest endpoint error does not pop up if there is no problem with the response. Here is the Ajax:

function checkFreeMeal() {

    var url_origin   = window.location.origin;

    $('#existing_guest_selector').on('change', function() {

        var guestID = this.value;

        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        $.ajax({
            type: "GET",
            url: url_origin + '/restaurant-reservations/check-free-meal/' + guestID,

            statusCode: {
                500: function() {
                    $('.something-went-wrong').text('LOOKS LIKE SOMETHING WENT WRONG. CALL IT DEPARTMENT FOR HELP. TELL THEM THIS. STACK TRACE ERROR: FREEMEALCHECK F1X00500');
                }
            },
            success: function(data) {
                if (data == 1){
                    $('.free-meal').prop('checked', true);
                }if(data == 0){
                    $('.free-meal').prop('checked', false);
                }
            }
        });

    });

}

So on existing guest dropdown change, the ID is being passed to the url of ajax along with the url_origin which returns https://domain.com. I am getting the expected result with no problem. But when I select the first item from dropdown (which has the value of null), the server should respond with a 500 error. That is what I am excepting at least. But that is not the case. (Also, the 500 error is caused on purpose and first value of first select item is null on purpose). So my question is, why am I getting the results when an ID is sent over but I am receiving insecure http error when there is an error coming. I am expecting 500 error from controller to the console from ajax but it displays the http insecure error.

Activity icon

Replied to Add A + 1 To WithCount()

@DEANSATCH - Understood. Thank you so much!

Activity icon

Replied to Add A + 1 To WithCount()

@DEANSATCH - Ok so in my example, I used guestpaxes as the relationship name. So it was getGuestpaxesCountAttribute. Which will eventually translate to get guespaxes relationship count using withCount. Correct?

Activity icon

Replied to Add A + 1 To WithCount()

@DEANSATCH - This worked perfectly. In my case it was getGuestpaxesCountAttribute. I do not understand mutators that well. I know what purpose they are for. is the get an attribute to mutators? and is Comments the same as the relationship name? Is Count an attribute to withCount?

Thank you

Jun
16
4 months ago
Activity icon

Started a new Conversation Add A + 1 To WithCount()

I have been using with('relation') and using the count($array->relationship) to get the count of the relationship. But obviously the easier way and cleaner way of doing that is using the withCount(). But the problem is that I am always adding a plus 1 to the count($array->relationship). So like count($array->relationship) + 1. How can I add that within the withCount()?

May
27
4 months ago
Activity icon

Replied to Not Able To Access Json

@TYKUS - Just needed to decode to array. Many thanks

May
26
4 months ago
Activity icon

Started a new Conversation Not Able To Access Json

I am outputting an object from a server and json_decode it. Here is the code:

//var $server_settings is from a RESTAPi
$json = json_encode($server_settings);

    return $json;

and the result:

{"settings":{"apc.shm_size":"32","character_set_server":"ascii","date.timezone":"","display_errors":"Off","error_reporting":"E_ALL & ~E_DEPRECATED & ~E_STRICT","execution_limit":"60","innodb_buffer_pool_size":"","innodb_lock_wait_timeout":"","key_buffer_size":"","max_connections":"150","max_input_time":"60","max_input_vars":"2500","memory_limit":"128","mod_xdebug":"disable","nginx_http2":"enable","package_versions":{"fpm":"enable","mariadb":"","mysql":"5.7","php":"7.3","redis":""},"short_open_tag":"off","static_cache_expiry":"43200","upload_size":"10","wait_timeout":""}}

how do I return lets say character_set_server from settings?

May
25
4 months ago
Activity icon

Replied to Need Some Help With Restaurant Menu Management System

@JOHNBRAUN - Hi

Sorry about the late reply. First off, thank you so much for taking the time in doing this. I can't thank you enough. I haven't got time to check this yet. But honestly, I do not think anyone would have taken their time to go this far answering a question. Again, thank you so much! I will get back to you after I am done testing.

But as far as I have read this, this is exactly what I needed and fits the requirements. The explanation was on point. Again. thank you!

May
20
5 months ago
Activity icon

Started a new Conversation Need Some Help With Restaurant Menu Management System

So the idea is pretty basic but I am not sure how it is done or how I should continue with it. Basically I am using laravel as my backend system and I wanted to allow the restaurant managers to add "menu options" to the menu items. when ever they add a new/update a menu item, they will be able to add options. Like if it is large or medium. If he wants pickles or carrots. It can be checkboxes or an input field or radio buttons. There will be many options to choose from. the managers will be adding this from the backend. Now I do not understand how my database would look like. Of course what ever table I create for menu options I will have to link it with the menu items table. That is obvious but how can I tell these things.

  • The category of the menu option. This will be something like, the size. Or the type of meat.
  • The type of option(s). Checkbox or an input field or radio buttons etc (there will be many options to choose from. one menu item may have 2 radio buttons which belongs to meat category and 3 checkboxes which belongs to size or something. It will vary.)
  • Lastly giving them name and id and other nesessary stuff. Also how can I display these (okay this will come later but for now I just want to figure out the db structure and how I could achieve this).

What I was thinking was to have a modal popup which will populate the given information above for the user. So lets say if the user clicked the "add to basket" button, they will be presented with the modal to choose size (maybe a radio button), Amount (which is an input field), extras (which maybe a checkbox). So how can I tell the db that these information/menu options are added in to the db to the specific menu item. What are the tables and relationships?

Thanks a bunch!

May
10
5 months ago
Activity icon

Replied to An In-depth Explanation Of Clear Cache

@JLRDW - Sorry currently I’m on mobile and it gives me 404 if I try on mobile. I always select the best answer (if any). But as soon as I get back on a PC

Activity icon

Replied to An In-depth Explanation Of Clear Cache

@SNAPEY - Thanks Snapey you saved the day once again! This pointed me to the right direction and it works perfectly.

Activity icon

Started a new Conversation An In-depth Explanation Of Clear Cache

Can someone please explain a little in-depth of what clear cache, route, config etc does? I tried searching a lot but I could not find any satisfying answer. What I really want to know is what is view clear. I know it clears compiled view files. But will clearing this force js and css to reload too? If not, how can I force them to be re fetched? Currently I use ?v=1.0 to clear both css and js. But sometimes the user has to close their tab and revisit the page again or do a reload (visiting links does not help) in order to re fetch the new css and js. So that got me thinking if clearing view would help? All I got from the internet so far was that clear view clears complied views. So my question is, will it clear and ask the client to get js and css again too? Will any of the clear commands do what I want to achieve?