Snapey

Director at Novate Ltd

Member Since 6 Years Ago

Mansfield

Experience Points
2,072,335
Total
Experience

0 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
1419
Lessons
Completed
Best Reply Awards
2923
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

  • community-pillar Created with Sketch.

    Community Pillar

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

Level 50
2,072,335 XP
Dec
03
14 hours ago
Activity icon

Started a new Conversation Efficient (re)sorting Operation Required

I'm after a bit of CS expertise please.

I'm working on a project that will use spaced repetition of flash cards. Given a fairly large set of cards, eg 500, depending on the user's competence with the answer, and the card's history for that student, the card must be moved back into the set so that it comes back around again at a greater distance the more often they get it right.

So, keeping it simple, say I have 100 cards in a line (ordered by some mechanism) if the card is answered wrong, I want to insert it into position 19. If answered correctly for the 1st time then reinsert it into the sequence at position 21 and if answered correctly for 2nd time, it moves to position 41.

Therefore I need to be able to 'insert' a card into the sequence at some given point. I obviously don't want to rewrite the position of cards 1-40 for instance (given that there could be 500).

Should I just hold the sequence as an array and serialise it to the database for long-term storage? I only need the id of the question not all the question and answer data.

What would you do? What simple algorithm am I missing?

Activity icon

Replied to 404 Error Usually Occurs In My Application, When Back Button Clicked Or Long Time Inactivity

This

But is this the permanent solution?? and even after 1 or 2 hrs students clicks logout they face 419|page Expired Error to avoid this error only i have increased the life time in session but still this error persist why??

is discussed here; https://talltips.novate.co.uk/laravel/csrf-and-expired-logout-forms

Check session lifetime with tinker

>>> config('session')

to make sure your incredibly long lifetime is taken correct

Activity icon

Replied to 404 Error Usually Occurs In My Application, When Back Button Clicked Or Long Time Inactivity

change /home in that file to a valid 'home' page for the user to go to

I think the route is called when the user is logged in via the 'remember me' functionality.

So if the user has been away for a while and returns, they are not prompted to login just sent HOME

BUT you need to find a reliable way to produce this error so that you know you have fixed it

Activity icon

Awarded Best Reply on WhereColumn Splits TableName.ColumnName As Two Different Columns

dont use array_push

You just want a normal associative array. change to;

$search_cols['inpatient_billing.consultant_id'] = $consultant_id;

and make sure you understand that these will be used as AND conditions so only records that match all terms will be returned

Activity icon

Awarded Best Reply on Session Data As Array

session('_sent', $request->all());
session('_availableCars', $availableCars);

or 

session(['_sent' => $request->all()]);
session(['_availableCars' => $availableCars]);
Activity icon

Replied to 404 Error Usually Occurs In My Application, When Back Button Clicked Or Long Time Inactivity

/home is probably in one of your middlewares

What Laravel version is it?

Activity icon

Replied to Session Data As Array

session('_sent', $request->all());
session('_availableCars', $availableCars);

or 

session(['_sent' => $request->all()]);
session(['_availableCars' => $availableCars]);
Activity icon

Replied to Session Data As Array

Why? just pass the data to the view from the controller

Activity icon

Replied to WhereColumn Splits TableName.ColumnName As Two Different Columns

dont use array_push

You just want a normal associative array. change to;

$search_cols['inpatient_billing.consultant_id'] = $consultant_id;

and make sure you understand that these will be used as AND conditions so only records that match all terms will be returned

Activity icon

Replied to 404 Error Usually Occurs In My Application, When Back Button Clicked Or Long Time Inactivity

You don't understand what are valid routes in your application? ??

So sometimes the user is sent to /home but you don't have such a route?

Activity icon

Replied to Session Data As Array

failing is not very helpful

It depends where you put them

Activity icon

Replied to Session Data As Array

why not?

install Laravel Debugbar so that you can see what is in session

Activity icon

Replied to 404 Error Usually Occurs In My Application, When Back Button Clicked Or Long Time Inactivity

Why are you so focussed on logout and sessions?

what url do they access?

You say they press back and go to xyz.com/home and get 404 but you don't say if /home is a valid Route?

Activity icon

Replied to Session Data As Array

session(['key' => 'value']);

so

session(['cart' => [
    'key1' => 'value1',
    'key2' => 'value2',
]]);

you know, like when you store an array in a variable....

Activity icon

Replied to WhereColumn Splits TableName.ColumnName As Two Different Columns

so you need to concentrate on how to create an array of key value pairs, and not worry about eloquent.

Your problem is basic php, or you could use a collection if its methods are more convenient.

Since you only show the one pair in your question, its difficult to see where the problem lays.

TBH most people would use the query builder when to build up the query dynamically based on request input

Dec
02
1 day ago
Activity icon

Replied to Adding Icon As Marker

Sorry should have picked up the hints that you were using leaflet and not google maps.

Activity icon

Replied to Refresh A Component When Updating Database

If you need to refresh a different component then emit an event and listen for it in the other component

Activity icon

Replied to WhereColumn Splits TableName.ColumnName As Two Different Columns

its correct, but your use of whereColumn is incorrect . This query is to compare one column against another column and therefore requires a pair of column names.

Why can you not use where

->where('inpatient_billing.consultant_id', $consultant_id)
Activity icon

Replied to Refresh A Component When Updating Database

when you send to the livewire component, it will re-render automatically.

So, your 'adding to ingredients' should be part of the ingredients component and after you save a new value the list will be re-rendered

Activity icon

Awarded Best Reply on 10 Properties With 2 Or 10 Tables ?

use an EAV store

https://en.m.wikipedia.org/wiki/Entity–attribute–value_model

used where a model can have an unknown number of attributes

Activity icon

Replied to How Do You Protect Your Site From Web Scraping?

you can make it more difficult by not having incrementing integers for record ids

Activity icon

Replied to Adding Icon As Marker

Did you try the steps I gave earlier?

Activity icon

Replied to Server's REQUEST_TIME

now() is pretty reliable, unless your middleware is taking multiple seconds to execute - which I doubt

Activity icon

Awarded Best Reply on How To Get The Results Inside FilterByEmail Function Inside Index Function?

Bit tricky to answer when we have no idea what this function is meant to do, no idea what that api call does, and no idea what is happening.

A couple of thoughts though. When you use $request->only you get back an array with key value pair. This may not be what you expected

Dont use env data in your code. Import it in a config file and use the config helper instead

Activity icon

Replied to Dash In Route Parameter Doesn't Work

clearly you cannot use a separator that might also appear in your 'name'

stick with

Route::get('/{name}/prices', '[email protected]');
Activity icon

Replied to Adding Icon As Marker

why strange? Yes its in a scripts section, in a blade file, but could equally be a js file

Dec
01
2 days ago
Activity icon

Replied to Adding Icon As Marker

This is what I do... no drama

    function init_map() {

        var map = new google.maps.Map(
            document.getElementById('gmap'), { zoom: 16 });

        var santa = {
            url: '/images/santa1.png',
            size: new google.maps.Size(50, 50),
            scaledSize: new google.maps.Size(50, 50),
            origin: new google.maps.Point(0,0),
            anchor: new google.maps.Point(25,25),
        }

        var marker = new google.maps.Marker({
            map: map,
            icon: santa,
            optimized: false,
        });   

santa is declared as an object with all its attributes

marker is added to the map and passes santa as the icon attribute.

The png file is located in /images/

Activity icon

Replied to Adding Icon As Marker

i doubt that..

Make sure you have the browser console open and check for javascript errors.

Don't just disregard the advice. You could stumble around for days, not learning anything. Your URL:asset... makes no sense at all.

Activity icon

Replied to How To Add Pop On Map Marker

Please format your code by putting 3 backticks ``` on a line before and after each code block

Activity icon

Replied to First Feedback - 2 Ideas To Improve Laracasts/discuss

Ref your point 2, your suggestion seems to indicate that the forum needs moderators. Its never had any, and I doubt will ever have. The person posting the bad question does not realise how badly structured their question is.

Activity icon

Replied to Adding Icon As Marker

basic tests

1, Put what you think the url should be in your browser address bar. If the icon does not appear, don't bother going any further until you find out why your web server cannot serve a static image. At this point this IS NOT a javascript or Laravel issue.

2, Assuming you know the correct url for the icon, put it in your code. Hard code it. Not asset, not URL helper, just the raw URI

Open the browser network tools. Refresh the page. See the assets being loaded. Look for the name of your file. Is it found and loaded? If it is in red then it was not found. Check the url being requested. Does it match the path that you think the image is located at? Is the image listed? if it is not even in the list of assets loaded then there is a javascript issue where your request to change the icon is not even considered.

If the browser network tools are new to you, step back for a moment and watch some tutorials on how to use them. They will be used over and over so is a key skill for a web developer.

Activity icon

Replied to First Feedback - 2 Ideas To Improve Laracasts/discuss

  1. @oxbir is an AI robot designed by jeff to test the patience of top contributors. After passing the test they attain the badge 'Suffers Fools'. @automica qualifies.

  2. Some questions are unsolvable (they are just bad questions) and OP should not be coerced to select a best reply when there isn't one. Some platforms close questions, but there are definitely cases where people can contribute a new solution to an old question. This is useful for those searching for a solution in the future. Personally I don't see an issue with the question being marked as unanswered. After a while you realise who the time wasters are and just leave them alone.

Last, I would not spend a lot of time on this. I build a new project every couple of weeks and I'm always starting from scratch with a different set of requirements and a rapidly changing landscape of available tools. I doubt you would see payback on your time.

Activity icon

Replied to Failed To Listen On Ipaddress:8000 (reason: Cannot Assign Requested Address)

How do you host the site when you are developing locally?

You host the site then find the IP address of your server on the local network, then type it into the browser address bar on your phone.

This has NOTHING to do with your router if everything is internal to your network.

Make sure any firewall on your local web server is configured to allow external devices to connect to your machine on whatever port you are using (8000 / 8080 / 80)

If you are using virtual hosts on your webserver then your mobile device will need to have its hosts file altered so that it can access the correct website on your local machine.

OR, use expose from beyondco.de https://beyondco.de/docs/expose/introduction

Activity icon

Replied to Calling Artisan Queue:work From Controller

queue:work starts a long running task. It will not complete and return the result code

change to this

$exitCode = Artisan::call('queue:work --stop-when-empty', []);

bear in mind that its still subject to the maximum execution time

Activity icon

Replied to Failed To Listen On Ipaddress:8000 (reason: Cannot Assign Requested Address)

it should be localhost not your router ?

Activity icon

Replied to I'm Trying To Run 'php Artisan Schedule:run' With Cronjob But It Returns Artisan List?

How is it 'emailing out'

Please paste the actual cron details, not your recollection of them

Activity icon

Replied to Laravel Livewire Indexes Random Keys To Array

You can't have a wire:model with the same name repeated in every item.

Nov
30
3 days ago
Activity icon

Awarded Best Reply on SQL Exists Query Does Not Return Relevant Result

If you know the category then I would start with that


$category = Category::where( 'slug', 'tonery-cartridge' )->first();


$products = $category->products()
	->where('name', 'LIKE', "%{$value}%")
	->with('manufacturer')
	->with('sm_image')
	->latest()
	->take(10)
	->get();

Activity icon

Replied to Login Redirection Not Works

Do you have a login button that directs to the login page?

Is your login page protected by authenticated middleware?

Does it work correctly if you temporarily comment this out;

    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }
Activity icon

Replied to SQL Exists Query Does Not Return Relevant Result

and 126 queries and 235MB of memory for one page

Activity icon

Replied to SQL Exists Query Does Not Return Relevant Result

If you know the category then I would start with that


$category = Category::where( 'slug', 'tonery-cartridge' )->first();


$products = $category->products()
	->where('name', 'LIKE', "%{$value}%")
	->with('manufacturer')
	->with('sm_image')
	->latest()
	->take(10)
	->get();

Activity icon

Replied to Calling Artisan Queue:work From Controller

Are you using php artisan serve in local development? That only has a single thread and cannot start another command from within a request.

Do you have the ability to create a cron job on your server?

I sometimes add this to console/kernel.php

        $schedule->command('queue:work --stop-when-empty')->everyFiveMinutes();

From the scheduler, this starts the queue every 5 minutes, then stops once the queue is empty. Perfect for clearing emails.

Activity icon

Replied to Array To String Conversion

Your title element has [] in its name, meaning that it is an array, but you are trying to echo it as a string;

{!!old("title", $lang->pivot->title ?? null)

Is there any reason why you used that syntax?

name="title[]{{$language->id}}"
Activity icon

Awarded Best Reply on The Charms Of Sessions

Laravel debugbar is good for sessions as you can immediately see what is in the session

Activity icon

Awarded Best Reply on Opening Emails In Website

https://github.com/Webklex/laravel-imap

but you are punching above your weight here... allow 2-3 weeks to get it going.

Activity icon

Awarded Best Reply on @yield And @section Isn't Working

You should return the show view not the welcome view.

Show is loaded and then extends welcome welcome is processed until it comes to @yield.

Route::get('/', function () {
    return view('show');
});
Activity icon

Replied to @yield And @section Isn't Working

You should return the show view not the welcome view.

Show is loaded and then extends welcome welcome is processed until it comes to @yield.

Route::get('/', function () {
    return view('show');
});
Activity icon

Replied to The Charms Of Sessions

Laravel debugbar is good for sessions as you can immediately see what is in the session