InspiredPrynce

InspiredPrynce

Software Manager at Solec Netlinks Nig. Ltd

Enugu State

Hire Me

Member Since 3 Years Ago

Experience Points 11,325
Experience
Level
Lessons Completed 97
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

12 Nov
1 day ago

InspiredPrynce left a reply on The MAC Is Invalid.

The problem is you generated a new APP_KEY, then if you try to decrypt the old encrypted data it will show the DecryptException: The MAC is invalid.

If you want to decrypt the old data you need to restore your old APP_KEY.

After realizing that, now, adding a new problem there, if you stored new data with another APP_KEY or another encryption method you have a problem on the data because they are mixed on the table.

In case you don't know when do you started with the new encrypt method or differentiate the new encrypted entries, the fastest solution would be reset all the passwords with the new encrypt method.

You can learn more about how Laravel encryption works on the official Laravel docs.

InspiredPrynce left a reply on Multi-Auth Page Has Expired Expired

I was forced to disable VerifyCSRFToken middleware! Hope it won't affect me in the future?

InspiredPrynce left a reply on Page Has Expired Due To Inactivity

@SNAPEY - I have tested everything and there is no error! Just plain old html form with @csrf included in it!

InspiredPrynce left a reply on Page Has Expired Due To Inactivity

I was forced to disable VerifyCSRFToken middleware! Hope it won't affect me in the future?

InspiredPrynce left a reply on “The Page Has Expired Due To Inactivity” - Laravel 5.6

I was forced to disable VerifyCSRFToken middleware! Hope it won't affect me in the future?

04 Nov
1 week ago

InspiredPrynce left a reply on Page Has Expired Due To Inactivity

@shez1983 its a simple form submit...

@cronix all of my forms contains @csrf and my sessions are working well... This is a multi-auth application

03 Nov
1 week ago

InspiredPrynce left a reply on Page Has Expired Due To Inactivity

@snapey it's in the post data...

@csrf is included

InspiredPrynce left a reply on Multi-Auth Page Has Expired Expired

Am not uploading a file, am submitting a simple form with the CSRF token available in the request...

InspiredPrynce left a reply on Page Has Expired Due To Inactivity

@tisuchi i ran your command and its still happening yet...

InspiredPrynce started a new conversation Multi-Auth Page Has Expired Expired

I have a multi-auth application, but whenever I submit some forms, it shows Page has expired due to inactivity and it returns a web guard instead of the logged in guard...

Please @Snapey how do i fix these issues?

28 Oct
2 weeks ago

InspiredPrynce started a new conversation Page Has Expired Due To Inactivity

I get page expired due to inactivity whenever i upload a file. Please whats wrong with my storage folder and how do i fix it?

Thanks!

InspiredPrynce left a reply on PHP String Manipulation

@DavidStiller thanks alot! It worked!

InspiredPrynce started a new conversation PHP String Manipulation

I have a string like this...

"Export Result for DMGS | JSS 1A | English Studies | 2017/2018"

JSS 1A is dynamic, i.e, it changes depending on the data exported. I only want to remove other parts of the string leaving just JSS 1A or whatever it is that will be placed there...

Thanks alot!

InspiredPrynce left a reply on Voting System With Laravel

Thanks guys, i appreciate

25 Oct
2 weeks ago

InspiredPrynce left a reply on Voting Systenm With Laravel

@shez1983 thanks for your response, please how can i..

  1. Store their cookies amd check it using laravel
  2. Store their IP address using laravel as well

Thanks

InspiredPrynce started a new conversation Voting Systenm With Laravel

Hello guys, am creating a voting system and the way it works, a user can only vote only once for a particular candidate! The issue is, I don't know how to restrict the users from voting for a contestant just once and once alone!

An insight would be highly appreciated!

Thanks y'all!

25 Sep
1 month ago

InspiredPrynce left a reply on Laravel Query

@Vilfago for President!!

Thanks man! Again!!

InspiredPrynce left a reply on Laravel Query

@jorpedito your code returns just a single subject name, nothing else

"English Language"

InspiredPrynce left a reply on Laravel Query

@Vilfago this is what i got when i ran your code...

 Illuminate \ Database \ QueryException (42000)
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'diocesan.subjects.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select * from `subjects` group by `name` order by `name` asc)

InspiredPrynce left a reply on Laravel Query

@jorpedito thanks for your answer. It's about longer, I currently have that in the code base but I want a very simplified approach to it with simple query.

InspiredPrynce left a reply on Laravel Query

@Vilfago thanks for your response. I want to list subjects from the database and I don't want the ones with same name appearing, I just want one of them duplicate ones alongside the others

InspiredPrynce left a reply on Laravel Query

@Galavant I have used that method and it returns everything except the ones with the same column name value, it should add one of them to the list.

InspiredPrynce left a reply on Laravel Query

@Galavant that's not what I meant!

I want to perform a query like this...

select everything from table subjects, if a row has the same name value as another row, please ignore that one and proceed to the next one. One you're done, show me all the ones you fetched.

@Snapey, @andreasbakir, @Cronix and @martinbean please help out!

You guys are the best here

InspiredPrynce started a new conversation Laravel Query

I have a table with multiple inputs, some data have the same name in the column name. I want to ignore all the rows that has the same column name value and pick just one! The unique one. How do i do it?

24 Sep
1 month ago

InspiredPrynce left a reply on Array Flatten

@andreasbakir this function doesn't seem to end once. When i use it twice or more, it returns the results in its previous usage. Its doesn't clear its memory, so to speak, how can this be fixed?

InspiredPrynce left a reply on Using A Function Twice

Thanks @Tray2, i've found where the problem is coming from...

/**
     * @param $score
     * @param $type
     * @return mixed
     */
    public static function get_grade_count($score, $type)
    {
        $grade = config('school.grades.'.strtolower($type));

        $grade_analysis = [];

        foreach($grade as $value) {
            $g = $score->where('grade', $value)->count();
            array_push($grade_analysis, [$value . '_point' => config('school.grades.' . strtolower($type) . '_points')[$value] * $g]);
        }

    //the sanitize_array() is the issue, so i changed it to array_collapse()
        //return sanitize_array($grade_analysis);
    return array_collapse($grade_analysis);
    }
}
22 Sep
1 month ago

InspiredPrynce left a reply on Need Suggestion

should work

InspiredPrynce started a new conversation Using A Function Twice

Hi LaraFolks, i have this function that calculates stuff for me

This is the whole controller

<?php

namespace App\Http\Controllers\Diocese\ExternalExams;

use App\Utilities\ControllerTraits;
use App\WAEC;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class WAECController extends Controller
{
    use ControllerTraits;

    /**
     * cPanelController constructor.
     */
    public function __construct()
    {
        $this->middleware('auth:diocese');
        $this->entity = new WAEC();
        $this->path = 'diocese.dashboard.external.waec.';
    }

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function index()
    {
        if($this->entity->all()->count() > 0) {
            if($this->entity->where('type', 'WASSCE')->count() > 0){
                $wassce = self::get_grade_count($this->entity->all(), 'WASSCE');
                $percent = array_sum($wassce) / ($this->entity->where('type', 'WASSCE')->count() * 9) * (100/1);
                $wassce_points = [array_sum($wassce), $this->entity->where('type', 'WASSCE')->count() * 9, round($percent, 2)];
            }
            else{
                $wassce_points = [0, 0, 0];
            }
            if($this->entity->where('type', 'JWAEC')->count() > 0){
                $jwaec = self::get_grade_count($this->entity->all(), 'JWAEC');
                $jwaec_percent = (array_sum($jwaec) / ($this->entity->where('type', 'JWAEC')->count() * 4)) * (100/1);
                $jwaec_points = [array_sum($jwaec), $this->entity->where('type', 'JWAEC')->count() * 9, round($jwaec_percent, 2)];
            }
            else{
                $jwaec_points = [0, 0, 0];
            }
        }

//when i dd($wassce_points) it returns well but when i dd($jwaec_points), it gives me data from $wassce_points

        return view($this->path.'index')->with([
            'waec' => $this->entity,
            'wassce_points' => $wassce_points,
            'jwaec_points' => $jwaec_points
        ]);
    }

    /**
     * @param $score
     * @param $type
     * @return mixed
     */
    public static function get_grade_count($score, $type)
    {
        $grade = config('school.grades.'.strtolower($type));

        $grade_analysis = [];

        foreach($grade as $value) {
            $g = $score->where('grade', $value)->count();
            array_push($grade_analysis, [$value . '_point' => config('school.grades.' . strtolower($type) . '_points')[$value] * $g]);
        }

        return sanitize_array($grade_analysis);
    }
}

This is my config('school.grades') file

<?php

return [

    'jwaec' => [
        'A', 'C', 'P', 'F'
    ],

    'wassce' => [
        'A1', 'B2', 'B3', 'C4', 'C5', 'C6', 'D7', 'E8', 'F9'
    ],

    'jwaec_points' => [
        'A' => 4, 'C' => 3, 'P' => 2, 'F' => 1
    ],

    'wassce_points' => [
        'A1' => 9, 'B2' => 8, 'B3' => 7, 'C4' => 6, 'C5' => 5, 'C6' => 4, 'D7' => 3, 'E8' => 2, 'F9' => 1
    ],

    'normal' => [
        'A', 'B', 'C', 'D', 'E', 'F'
    ]
];

when i dd($wassce_points) inside the index() it returns well but when i dd($jwaec_points), it gives me data from some data from $wassce_points. it acts as if the function get_grade_count() didnt stop running! It keeps running without clearing the previous data in it!

How do i fix this guys? Am running crazy here!

20 Sep
1 month ago

InspiredPrynce left a reply on Twisting Model::all()

@lostdreamer_nl thanks alot! That was quite simple!

InspiredPrynce left a reply on Twisting Model::all()

@Sergiu17 i want to do that inside my model so i wont be doing that all the time

InspiredPrynce left a reply on Students Position From Average

@burlresearch wow! This is beautiful! Your function is quote nice and can easily be manipulated by yours truly! This is nice! Thanks man

InspiredPrynce started a new conversation Twisting Model::all()

I want to sort my eloquent data before they are displayed wherever they are called upon. I want to change the way they are ordered before they get displayed! How do i acheive this?

19 Sep
1 month ago

InspiredPrynce left a reply on Floats Vs Integers

@martinbean Thank you so much man! I appreciate the help! It worked like a charm...

You are a life-saver.. You should be in the first aid kit!

InspiredPrynce left a reply on Floats Vs Integers

@martinbean please how do i fix this? I opted to round the number up but the points are needed so how do i check for number in between a range...

Thanks

InspiredPrynce started a new conversation Floats Vs Integers

I have a function that checks the grade of students...

 public static function get_grade($score)
    {
        if($score>= 70){
            return 'A';
        }
        else if($score>= 60 && $score<= 69){
            return "B";
        }
        else if($score>= 50 && $score<=59){
            return "C";
        }
        else if($score>= 45 && $score<= 49){
            return "D";
        }
        else if($score>= 40 && $score<= 44){
            return "E";
        }
        else if($score>= 0 && 39){
            return "F";
        }
        else{
            return 'F';
        }
    }

I have this score 49.98 and from the function, it' supposed to fall into this category...

 else if($score>= 45 && $score<= 49){
       return "D";
 } 

But it returns "F" which happens to be here...

else{
    return 'F';
}

Please what could be the issue and how do i resolve this?

InspiredPrynce left a reply on "The Page Has Expired Due To Inactivity. Please Refresh And Try Again."

I have the craziest fix to this


//errors/419.blade.php

@extends('errors::layout')

@section('title', 'Page Expired')

@section('message')
    The page has expired due to inactivity.
    <br/><br/>
    <a href="{{ url()->previous()  }}" style="text-decoration: none; color: inherit">Click Here To Refresh</a>
@stopassola 

This is better please...

17 Sep
1 month ago

InspiredPrynce left a reply on Students Position From Average

@Vilfago thank you so very much dude! You a life saver! You should be in the first aid kit!

15 Sep
1 month ago

InspiredPrynce left a reply on Students Position From Average

@Vilfago here is the output


array:1 [▼
  0 => array:2 [▼
    0 => 1
    1 => array:21 [▼
      3913936730 => 28.0
      3913239999 => 21.73
      3913659614 => 22.0
      3913160091 => 19.47
      3913885329 => 29.73
      3913582846 => 30.27
      3913645641 => 15.4
      3913087292 => 23.73
      3913646349 => 14.93
      3913280872 => 21.87
      3913028769 => 13.6
      3913747249 => 26.8
      3913049985 => 22.4
      3913083105 => 25.07
      3913282411 => 40.0
      3913662799 => 39.87
      3913261052 => 20.67
      3913865578 => 9.2
      3913062432 => 17.73
      3913395866 => 35.6
      3913059859 => 34.0
    ]
  ]
]

InspiredPrynce left a reply on How To Solve It

@fam you're submitting the submit button as well?

InspiredPrynce left a reply on Students Position From Average

@Vilfago there is an error in this


if($result < $current_score){
        $current_score = $result;
        $current_rank += $number_in_position
        $number_in_position = 1;
        $output[$pin] = [$current_rank, $result];

        ++; //What are you incrementing here?
    }

InspiredPrynce left a reply on Custom Redirect After Registration Validation Failure - Call To Undefined Method Illuminate\Http\RedirectResponse::validate()

Change your function to this

protected function validator(array $data)
    {
    return Validator::make($data, [
           'username' => 'required|string|max:255',
            'email' => 'required|email|unique:users,email,'.Auth::id(),
            'password' => 'required|string|min:6',
            'country_id' => 'required|integer|exists:countries,id',
            'mobile' => 'required|numeric|min:6|max:15',
        ]);
    }

//If you want to retain your form data if validator fails, do this

<input type="text" name="email" value="{{ old('email') }}" required>

Hope this helps! Best regards

InspiredPrynce left a reply on Count The Votes For An Article

If you are using eloquent relationships, you should be doing something like this...


$article = auth()->user()->articles()->find(1); 
//where 1 is thr article Id

$article->votes()->count();

InspiredPrynce left a reply on Blade - Displaying Unescaped Html

Can i see your code and the result?

14 Sep
1 month ago

InspiredPrynce left a reply on Students Position From Average

@Vilfago can you help out? At this point am tired... Please help. ???

InspiredPrynce left a reply on Students Position From Average

@burlresearch there is a slight issue here...

3913261052  10th    51.46
3913936730  9th             51.46

Aren't these two supposed to be 9th then the next one coming becomes 11th?

InspiredPrynce left a reply on Students Position From Average

@Vilfago thank you as well! I appreciate

InspiredPrynce left a reply on Students Position From Average

@burlresearch thanks alot! It worked perfectly...

InspiredPrynce left a reply on Students Position From Average

@Vilfago i want an output like this..

array:10 [
    3101625668 => ["1st", 98.0],
    3101635921 => ["1st", 98.0],
    3913126364 => ["4th", 35.77],
    3913058204 => ["7th", 25.33],
    3101372540 => ["5th", 33.47],
    3913752741 => ["3rd", 40.0],
    3913120054 => ["9th", 20.4],
    3913998755 => ["6th", 26.67],
    3913861492 => ["8th", 25.2],
    3913881854 => ["10th", 19.8]
]

InspiredPrynce left a reply on Students Position From Average

@Vilfago i would really appreciate it if you can show me a working example. I've been at it since, have sorted the shit outta this array. Please help...