Member Since 3 Years Ago

Experience Points 19,380
Experience Level 4

620 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 181
Best Reply Awards 0
Best Reply
  • 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.


    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.


    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.

27 Aug
10 months ago

Birdy left a reply on Nova Series?

+1 for laravel nova series

22 May
2 years ago

Birdy left a reply on Laravel 5.3 With Passport: Get Current User With Personal Access Token.

@fwartner - Could you spare a minute to check out this thread please >

And if possible share some advise on my question, Will be greatly appreciated. Thanks :)

Birdy started a new conversation Advice On Authenticate Using Passport / OAUTH For Api As A Service.

After playing around with laravel passport i am starting to assume i may be slighly overkilling the needs of my application when using the full OAuth and Passport authentication systems.

My basic concept is to provide a free api as as service to a beta testing comunity of around 30 people.

The way the api works is to make http requests to - My custom solution uses a UUID attached to the user and also an api_key that the user can create and delete.

To authenticate the user an example request is made like so:

uuid = 1234-5678-9012 api_key = avb342wds-45erd56-qwa

To validate this we check that the uuid provides has full ownership of the api_key and if it does then we check the api_key has permission to access the resource requested, the uuid and api_key is basically acting as a username and password.

That being said i have hoped to move more towards the laravel/passport way of doing it and using passport to achieve the same sort of outcome.

Is this possible by using the personal access token or another implementation of passport i am unaware of?

Or am i thinking incorrectly and both oauth and passport do not work this way?

Any advice would be greatly appreciate, Thanks.

Birdy left a reply on Laravel 5.3 With Passport: Get Current User With Personal Access Token.

@arifulhb - Did you manage to get this working. I am currently having the same issue?

14 May
2 years ago

Birdy left a reply on How To Create API Calls Limit Middleware ?

@timersys - Did you get this resolved? im facing the same issue :(

31 Mar
2 years ago

Birdy left a reply on Pulling My Hair Out Over Middleware In L5.4!!

@oaj - Thank you for your solution it seems that i have found the issue that was causing the problem.

It seems that the request MUST be declared like so:

if (!$request->is('phone/verify')) {

And if you declare the route request as this:

if (!$request->is('/phone/verify')) {

(Note the / in front of the /phone... Using a / in front of the route makes the page go into an infinite redirect.

Not sure what and why this happens but declaring the route without a / in front of the /phone/ makes everything work as expected!

Thanks @oaj

Birdy left a reply on Pulling My Hair Out Over Middleware In L5.4!!

@oaj - Give it a try now mate and let you know, I appreciate the help :) I feel the redirect loop is certain its just the cause that was confusing me as every question i have read seemed to say the middleware i original used works for other peoples use cases.

30 Mar
2 years ago

Birdy started a new conversation Pulling My Hair Out Over Middleware In L5.4!!

Hey all,

After several stressful hours i have come to the point where i need to reach out for some advice.

I have read many other posts and have i tried to accomplish what it is i need to do by following what others have said in posts, threads and answers.. That said i can not for no love nor money get this working.

Basically i need a set middleware to check every request made by an authenticated user, The if condition will check to see if the user has verified their phone number / mobile number.. If they have not verified their number they will always be shown a verify number page or be redirected to the phone number verification url regardless of what page or url they try to visit unless they are logged out or unless they visit the logout url.

I could not get this working so To start with i have taken my middleware back to basics and no matter what i do i can not get this working, I feel i am either missing something simple or i am just doing it totally wrong!

here is the middle ware and how my kernel has the middleware assigned.


namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class CheckPhoneVerification
     * Handle an incoming request.
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
    public function handle($request, Closure $next)
        $user = $request->user(); // Also tried using Auth::user() and Auth::check();
        if ($user->phone == "") {
            return redirect('/phone/verify'); // Also tried just to return a view!
        return $next($request);

If i try to return a view instead of redirecting the user to the /phone/verify url i get this error...

FatalThrowableError in VerifyCsrfToken.php line 156: Call to a member function setCookie() on null

And if i redirect the user to a url i get this error... The page isn't redirecting properly

If i remove the middleware everything works perfectly and if i implement the same condition on a controller it works as should, so im guessing i must be doing something wrong :(

protected $middlewareGroups = [
    'web' => [
        // \Illuminate\Session\Middleware\AuthenticateSession::class,

Would really appreciate any help on this one if possible please.

28 Mar
2 years ago

Birdy left a reply on Is It Possible To Access Laravel.log From A Public Domain Url?


When you say serve from public folder, You meaning laravels public folder or a specific public folder such as public_html and have the rest of the app outside of the public_html directory?

26 Feb
2 years ago

Birdy left a reply on Is It Possible To Access Laravel.log From A Public Domain Url?

Infact it can actually be accessed sometimes without even realising by doing something along these lines... (P.O.C -> I know this from previous experience!!)


also i have known this to work...

The best thing to do that i have found works well is to block access to .env / composer.json and storage folder in either htaccess files or nginx conf.

You would be surprised how many servers / applications there are that leave them selves wide open to attacks.

A simple google search would provide hundreds of rootable servers through simple miss configuration and put into production mode thinking these files and folders are not accessible...

I know this first hand from testing prior to production.

25 Feb
2 years ago

Birdy started a new conversation Storing Cofig Settings In Database Fails At Runtime..


I am using the efriandika/laravel-settings package to store key value settings in a database.

My idea behind this was to dynamically assign the stored values to the main config settings in laravel but i believe this fails at run time due to this following error:

RuntimeException in Facade.php line 218: A facade root has not been set.

I am trying to store things like default flysystem values and retrieve them like so:


However i get the error yet if i use this on a model, controller or view there is no error.

Do i need to have a custom service provider with a boot method?

I am still learning laravel so im not to sure what the best approach is on this and hoping someone with greater knowledge can share some advice.


19 Feb
2 years ago

Birdy started a new conversation Possible Bug With Laravel 5.4?

Hi all,

I have been getting a specific error with laravel 5.4 as seen below, All i have changed is APP_DEBUG and APP_LOG_LEVEL in .env file and now i cant get the app to load at all, All i get is a blank white page!!

Symfony\Component\Debug\Exception\FatalThrowableError in /jet/app/www/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php line 221: Call to undefined method Illuminate\View\Factory::flushSectionsIfDoneRendering()

As you can see laravel was calling an undefined method on the factory class, When you inspect the difference between laravel 5.4 and larvel 5.3 factory class's you can see that the flushSectionsIfDontRendering() have been changed to flushStateIfDoneRendering() in laravel 5.4.

I set APP_DEBUG and APP_LOG_LEVEL both from true to false in .env file and now the application wont load what so ever, and i get this error.

php artisan

PHP Fatal error:  Uncaught InvalidArgumentException: Invalid log level. in /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/Writer.php:334
Stack trace:
#0 /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/Writer.php(215): Illuminate\Log\Writer->parseLevel(true)
#1 /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php(73): Illuminate\Log\Writer->useFiles('/jet/app/www/st...', true)
#2 /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php(60): Illuminate\Log\LogServiceProvider->configureSingleHandler(Object(Illuminate\Log\Writer))
#3 /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php(36): Illuminate\Log\LogServiceProvider->configureHandler(Object(Illuminate\Log\Writer))
#4 /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php(18): Illuminate\Log\LogServiceProvider->createLogger()
#5 /jet/app/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(678): Illuminate\Log\LogServiceProvider->Illuminate in /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/Writer.php on line 334
PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\FatalErrorException: Uncaught InvalidArgumentException: Invalid log level. in /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/Writer.php:334
Stack trace:
#0 /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/Writer.php(215): Illuminate\Log\Writer->parseLevel(true)
#1 /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php(73): Illuminate\Log\Writer->useFiles('/jet/app/www/st...', true)
#2 /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php(60): Illuminate\Log\LogServiceProvider->configureSingleHandler(Object(Illuminate\Log\Writer))
#3 /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php(36): Illuminate\Log\LogServiceProvider->configureHandler(Object(Illuminate\Log\Writer))
#4 /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php(18): Illuminate\Log\LogServiceProvider->createLogger()
#5 /jet/app/www/vendor/laravel/framework/src/Illuminate/Container/C in /jet/app/www/vendor/laravel/framework/src/Illuminate/Log/Writer.php on line 334

Any help or advice would be greatly appreciated, i really don't fancy reinstalling everything and restarting the project, My backup is a week out of date so it would be heart breaking!

25 Oct
2 years ago

Birdy left a reply on Relationship Or Not? Cant Seem To Solve The Bleeding Problem!

@willvincent @Snapey - Sorry for the late reply, I greatly apprciate your help once again :) thanks for taking time out of your day to assist and help me achieve the result i needed, Take care and thanks.

22 Oct
2 years ago

Birdy left a reply on Relationship Or Not? Cant Seem To Solve The Bleeding Problem!

@maitrefrantz @willvincent - My apologies for the very low explaination to my issue, I have the kids this weekend so its somewhat hectic trying to code and babysit haha.

I have not used migrations as i already had a project within php and phpmyadmin before switching to laravel and i have not had chance to convert all my tables to migrations properly as of yet, That being said i have had no issues with other relationships and ill give a quick overview to the database structure.

projects table has the following:

id (Primary with Auto-Inc) project_id (Unsigned) rest are just normal int/varchar columns.

My appointment model had to revert to the following:

public function project($projectId)
    return Project::where('project_id', '=', $projectId);

However i did have this:

public function project()
    return $this->hasMany(Project::class, 'project_id', 'project_id');

my appointments table has the following structure:

id (Primary also auto-inc) project_id (Unsigned) user_id(unsigned) rest is usual int/varchar columns

How records are stored is that the project_id on the likes of the appointment table is the same as the project_id column within the projects table although not actually referencing the (id) column its self as there is a dedicated project_id column that uses a (kind of) unique int that should be unique to the user at the time as it is created from their ip address followed by a timestamp and is placed into a 11 digit integer.

All tables such as appointments, payments, jobs, invoices ect ect all have a project_id column that refers to the exact project_id column within projects and has the value that is assigned to the project_id

so for example in the projects table here is a dummy records:

id = 1 project_id = 29371861087 title = description = ect ect..

and appointment example:

id = 1 project_id = 29371861087 appointment_date = (timestamp from carbon) appointment_time = 10:30am ect ect

and a payments table example:

id = 1 project_id = 29371861087 payment_type = paypal payment_amount = 20.00 ect ect

So i need to be able to loop through all the users appointments and where the appointments are showing for example here is some html:

{{ $appointment->appointment_date }}

{{ $appointment->appointment_time }}

{{ $appointment->project()->title }}

{{ $appointment->project()->description }}

Does that kind of give a better example?

I basically need to be able to fetch each project assocatiated with each appointment so when i loop over the appointments array i can do something similar to the above.

I really really do appreciate your help guys, Its people like yourselves and laracasts that help people like me gain a whole new adventure in life, Sorry if my spelling, grammer and explaination is not the best as im trying to type it as quickly as possible while i have 5 minutes free as the kids are glued to peppa pig on tv at the moment haha!.


Birdy started a new conversation Relationship Or Not? Cant Seem To Solve The Bleeding Problem!

Hi guys after many stressfull hours i have had to turn to you for help!

within my models i have an appointment and a project model both have their own tables ect and what im trying to do is loop over the users appointments witch is working fine and would go something like the following example:

@foreach($appointments as $appointment) {{ $appointment->date}} {{ $appointment->time}} {{ $appointment->project_id }} @endforeach

Where i am struggling is the relationship to the projects table because i need to display the project name and description on the appointment page so for example when the foreach loops through the $appointments it will display the appointments and the correct project id's so for example:

1 2 3

However i then need to reference the projects table where the project_id is = to the $appointment->project_id

I have tried this several ways, a belongsTo method, hasOne and even tried the following: $project = Project::where('project_id', '=', $appointment->project_id)->get();

That works fine however it only ever gives me the first object from the foreach loop, Where as i need to be able to reference all three projects from provided by the appointments table if you see what im saying.

A perfect working example would be:

@foreach($appointments as $appointment) {{ $appointment->project()->projectName }} @endforeach

I have even tried this:

@foreach($appointments as $appointment) @foreach(\App\Project::where('project_id', '=', $appointment->project_id) as $project) {{$appointment->date}} {{$appointment->time}} {{$project->projectName}} @endforeach @endforeach

Everything works but only seems to give the record for the first project id lets say 1 even through the appointments foreach loop is providing three different appointments for three different project ids.

This to me seems so simple however after several hours an a full night coding i have basically lost myself in fustration and more than likely overlooking the most simple way as ive tried so many different ways and failed you tend to forget the basics.

Would really apprciate some support on this one guys, it will be much apprecaited and will help me get to the next stage!

Thanks all.

16 Oct
2 years ago

Birdy left a reply on Populate Template From Database And User Object...

@willvincent - ive not tried that yet as the template is loaded via ajax and you select what template you want from the drop down select menu No page refresh ever takes place so dont think it would work as good.

However that being said.. based on what you said previously it gave me the right phrases to use when doing further research and i found my fix within minutes!!!

Simply all you need to do is:

include the Blade facade: use Illuminate\Support\Facades\Blade; then you can use: Blade::compileString($templateAsHtml);

and in my case i just use return Blade::compileString($templateAsHtml);

However a note to anyone else who comes a cropper with the same issue i did, You must store the varaible tags with single brackets within the database and not double otherwise it would echo out like this: {My template content} as apose to: My template content.

Thanks a lot @willvincent you saved me a lot more wasted hours i would have spent trying to learn the right way!


Birdy left a reply on Populate Template From Database And User Object...

@willvincent i didnt think of running it through the blade compiler though i assumed i would need to run it through something as thats basically what i am doing, Attaching html data thats stored in a database table to a variable or stored function then wanting to echo it in a view replacing the variables that are in the stored html with the real object values so the stored {{$user->name}} object and value will get replaced dynamically with the real {{$user->name}} object as if you was passing the user object straight to the view however i have my current template controller returning it like this:

public function changeTemplate(Request $request)
    $template = new Template();
    $templateAsHtml = $template->fetchHtml();
    $userObject = User::where('id', '=', '1')->first();
    return view('dev.template',     compact('templateAsHtml', 'userObject'));

the $templateAsHtml has the following example html stored at the moment:

in the view i have: {{ $templateAsHtml->content }} and it displays the following in html but the blade syntax gets displayed in plain text:

Hello {{$userObject->name}} your email is {{$userObject->email}}


Birdy started a new conversation Populate Template From Database And User Object...

Hi all its been a while since i last posted so not to sure on if i should post in the general area or not, IF i have posted in the wrong area i apologise and hope a mod can move it to the required area..

As for my question it is somewhat a cry for help after several hours of failed attempts and i am now begining to assume its not possible however i live with the moto "Anything is possible" ha!

Basically as a new developer / learner, I have managed to integrate summernote wysiwyg editor (After many many stressful hours haha!) That performs an ajax request to the server to fetch the required template based on a select option value... so select option value 1 for example will fetch template with the id of 1 stored in a 'templates' table and so on...

I have that working fine, The thing i have been trying to get to work is dynamic tags so for example just using basic login to fetch the user with id of 1 and template with id 1 from an ajax call, I was hoping to have the template populate the dynamic tags with the user object values i require for the template.

To achieve this i have tried to store a template in the templates table along the following lines:

templates table and the column name is templateContent

Hello {{$user->name }}

when this returns the templateContent column to the view along with the $user object it does not populate or echo the value i have tried using blade syntax and php code (Knowingly it is a security issue however im just trying to get the concept working first before i tackle anything else!)

to make sure the $user object is being passed to the view i can use {{ $user->name }} perfectly fine, It just does not echo out when i fetch it within the

hello {{ $user->name }}

format that is stored in the templatesContent column...

I hope this kind of makes sense?! As a leaner im not fully familar with the syntax and wording that you more advanced developers use but we all start somewhere :)

If this way wont work or doesnt work full stop can someone please suggest a method i could use to acheive the end result i need?

That would be my templates html stored in the templateContent column that when rendered to the view or in my case (summernote / wysiwyg editor) will populate with the $user object fields/values i require for the view.

here is a demo template:

Hey {{$user->name}}, thanks for being a cool laracasts learner.

your telephone number is {{$user->telephone}} and your email address is {{$user->email}}

i know i can save these directly as a view however the only reason i need this within the wysiwyg editor is so i can edit templates before i send them within the editor and the editor will have already populated the values for me prior to sending the email or sms message :)

Thanks for taking the time to help out, it is much appreciated.

13 Apr
3 years ago

Birdy left a reply on Been Pulling My Hair Out For Amount 7 Hours!!!

I started to build this app while learning the basics of laravel and angularjs, ive progressed a lot in both areas and there is a lot of refactoring that is to be done so that is inhretible and i will more than likely use the default as soon as i can get chance to change everything as at the moment the code is very messy, its import i get the app back online as apose to spending more time debugging and refactoring, i can do that while the app is live.

im trying to locate where abouts within the default auth or password controllers it is that its hard coded to lookup the email column. Ill take a look later today and see if i can hunt it down. After doing 24 hours straight you tend to overlook the simple things after looking at code for so long :p

Birdy left a reply on Been Pulling My Hair Out For Amount 7 Hours!!!

I have found the problem im just trying to find a solution now :)

The problem is the useraccounts table has the email column named: 'email_address' and not 'email' and same goes for the password_resets table.

I have just tried renaming the columns to 'email' and its works perfectly, So i just need to figure out how i can instruct the default Password Reset and Auth Controllers that they should be querying 'email_address' for password resets and not 'email'


Birdy left a reply on Been Pulling My Hair Out For Amount 7 Hours!!!

Both of the above seem to do fix it and result in the same outcome as follows:

 QueryException in Connection.php line 669: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'email' cannot be null (SQL: insert into `password_resets` (`email`, `token`, `created_at`) values (, 0e50107bb90e127ee60fadc7edf40fe594691a8260f382e70f225ebe4f882298, 2016-04-13 03:57:21))

This seems to be futher than i got before, my guess here is that its expecting the fields such as email, where as my password reset form is sending the field named email_address, where would i change this, ive gone through most of the password and auth controllers but i dont see a specific email field that would identify thats what its using for the query.

@daniyum21 - You mention to check the controller that is resetting the password... this maybe a stupid question but do i need to create a password reset controller because i have not done so, i assumed the default artisan make:auth did that, if so this could explain all the issues ive had! I have over 40 controllers and the app is fairly large so it would be a stupid error to miss if i have overlooked this!

Thanks guys, much appricated.. ive been stuck on this since 9am yesterday morning and its now 5:05am so tiredness can get the better of you :)

12 Apr
3 years ago

Birdy left a reply on Been Pulling My Hair Out For Amount 7 Hours!!!

@zachleigh Thanks for taking time out to help, i appreciate it. I have updated the above and included my full UserLoginModel. Thanks

Birdy started a new conversation Been Pulling My Hair Out For Amount 7 Hours!!!

Hi All,

Well after 7 hours of hitting a brick wall ive decided to ask for some help!

When i started to build my laravel app i did not use the default user.php model and infact created my own called UserLoginModel.php then to make things even more harder for myself (At the time i didnt realise that it would do) i then created a database with the tables i needed and for the usersaccounts table what would normally be called users by default with laravel, My email column is called "email_address"

Everything has worked fine up to now, At the moment im facing issues with the password reset function and trying to get larvel to work how i need it to.

im getting this error message when i submit my password reset form with just the email_address field so laravel can send the email link to the provided email address.

UnexpectedValueException in PasswordBroker.php line 238: User must implement CanResetPassword interface.

The validation is working because if i enter an email that does not exsist it gives me the correct error message, it seems to throw the above message when its trying to do its correct process.

my auth.php: 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'table' => 'useraccounts', 'model' => Beta\UserLoginModel::class, ],

My UserLoginModel.php

Can someone please be kind enough to point me in the right direction?

It will be very much appricated, Thanks.

15 Mar
3 years ago

Birdy left a reply on Friendly URL's By Displaying Name Apose To ID...

@Snapey - Ideally i would like to have friendly urls as appose to having a unique id of something like: 3re23rf43v4-2424x2zs245-2saa2a-5nsgd5532s in the url to identify the users UUID, so something like i mentioned with .../profiles/John-Doe would be ideal but the only way i could do that is create a slug based on their firstname-lastname and insert it to a slug collumn within the DB and if its taken then use something like John-Doe-19. Guess all angles of input is better than one mind doing overtime!

Birdy left a reply on Friendly URL's By Displaying Name Apose To ID...

@jlrdw - I never even thought of doing that?! Might be tricky though passing it to the session as if the same user happens to click another profile then i would have to continually push the new value to the same session key, am i right?

@Snapey - They can either click through using href, buttons or similar and alternatively nothing stopping them using general get request.

Example: just doesn’t look right does it? John-Doe might match the real name of the profile but its mainly just a dynamic parameter that doesn’t make any different its more the /178372/ unique id number that the query runs on but if i can pass that without having it in the url so in fact the correct url would be: but in reality somehow the query is switching the name in the request for the relevant unique id behind the scenes.

Does this make sense or am i baffling you? As a newbie im not sure on the correct terms and phrases to use when it comes to syntax and mark-up so i give my apologies on that.


14 Mar
3 years ago

Birdy left a reply on If Page Pagination Is Greater Than..

@jekinney - I like what your saying, Great input and very much appreciated. As it happens time is very short on this project and i guess what you say is right, I should look at this as one of the refactoring stages not an essential before production. Thank you for taking the time out its very greatly appreciated.

Birdy started a new conversation Friendly URL's By Displaying Name Apose To ID...

Hi all, I know this has been covered in similar questions but i can’t find anything that is exactly how i need it to be which leaves me wondering if its possible or not. My knowledge of laravel is rather limited and I’m by no means an expert in php or any other language! One would suggest a beginner status is appropriate in my skill set!

What I am actually trying to do is retrieve a record from my database without having to send the ID in the url or anyother numeric identifier, I was hoping to be able to have the url structure something as follows:

I know I could do a simple query to get either the username or full name but there is two reasons Im hoping there could be a workaround, The first reason is the user signs up with Email and Password followed by First name and Last name input fields and the second reason is that there could be another user name John Doe.

Right now my urls look like this: with the number being the unique identifier.

Would it be possible to switch this out and refer to the profile by name but still lookup the database using the id field? Surely some of the biggest websites out there that hide numeric fields and replace them with named fields are using some sort of switch method or something that can achieve a similar approach?

In theory im basically trying to mask the url or trick the url as I don’t want someone to be able to just swop out the name like so: for and be able to access the next profile so using a unique identifier like the first example I show is something I would prefer to have as the database query but just mask the url with the name if this is possible in anyway?

Much appreciated for any help or input given. Thanks for your time.

13 Mar
3 years ago

Birdy started a new conversation If Page Pagination Is Greater Than..

Hi, Im using the built in simple pagination with custom css. As you are probably aware, Laravel appends the pagation page ids to the url when using pagination, However if some malicious user as such wants to try and get technical, Lets say we have the following setup:

and now we have added 3 pages of pagination

he or she can then add the following: ?page=30 and so on...

Though this does not break the site it will stop rendering the pagination results because there is not for page 30 and so on... So i wanted to add something simple to my controller maybe an if statement to say count the pagination number given by laravel using: $reviews->hasMorePages() or even $reviews->count() then use something like this:

$pageID = $_GET['page']; $reviewCount = $reviews->count(); if($pageID > $reviewCount){ return redirect->back(); }

Excuse the code as ive not tested it in any way i have just quickly typed it out as im writing this message so the syntax may be a bit ski wiff!

Any suggestions on the best approach here? Im basically trying to verify that the page parameter is not greater than the $pagination->count() function and if it is then its been modified manually or maliciously so redirect back or redirect to first page / article page.


21 Feb
3 years ago

Birdy left a reply on Eloquent Insert From Select


Sorry to bother you again, everything is working perfectly except one small issue, When the first query is executed to select 5 default project bids at random then pass them to the second query to insert into the saved_estimations table, This works fine and the user is then redirected to another route like so:

return redirect()->route('step4', ['projectid'=>$projectid]);

Once the user is redirected he/she can view the 5 estimations with no issues, The problem i have is if the user hits the back button and goes through the step3 process again it triggers the random select function to then insert 5 more rows into the saved_estimations table causing duplicated content.

I have read the docs and also tried using firstOrCreate / firstOrNew but no matter what i cant get round the duplication inserts, Here is a snap shot of 5 dummy inserted rows of the random estimations into the saved_estimations table.

bid_id project_id category_id property_value_id service_providers_id bid_price bid_message created_at updated_at 699833 3586775809 1 1 26 325.00 NULL
699834 3586775809 1 1 28 339.00 NULL
699835 3586775809 1 1 32 342.00 NULL
699836 3586775809 1 1 35 330.00 NULL
699837 3586775809 1 1 37 345.00 NULL

And if the user hits the back button and passes through the same controller it will insert another 5 rows the same as above with randomly selected data for the same project_id so in a nutshell i need to figure a way to check if there is already 5 rows inserted in the saved_estimations table with the same following fields: project_id, category_id, property_value_id and if there is then either update them or skip the process entirely and move to the next step. I have tried a few different ways but not yet found a way to get this work.

Do you think its possible with an if statement or even a while or foreach loop to update the given fields?

Thanks again its very much appreicated.

Birdy left a reply on Eloquent Insert From Select

And this is why asking for help now and again can really pay off :) !

I Really appreicate that, I have gone through a lot of the docs but as im still on the starting line with laravel it is somewhat difficult at times to know exactly what to research when it comes down to the terms used and phrases refered to.

I must say laravel has become something of a superstar in my eyes though more time consuming when your first starting out just because of the reasons i say above, Other than that it can save you a lot of coding and repeating yourself over and over like you would hard coding without OOP or Frameworks.

Again, Much appreciated and i thank you for taking time out to lend a helping hand, Enjoy your weekend :)

Birdy left a reply on Eloquent Insert From Select


Ive done some custom php work in my controller and come up with the following, This works tempory and im hoping i can work on making it a little better and more cleaner, Possibly even refactor it to a more suitable laravel 5.2 version.

Whats your thoughts,

    $results = $bidders;
    foreach($results as $row){
        $project = $projectid;
        $category = $row->category_id;
        $provider = $row->service_providers_id;
        $bidprice = $row->bid_price;
        $propvalue = $row->property_value_id;

            'project_id' => $project,
            'category_id' => $category,
            'service_providers_id' => $provider,
            'bid_price' => $bidprice,
            'property_value_id' => $propvalue


20 Feb
3 years ago

Birdy left a reply on Eloquent Insert From Select


As a novice to laravel and still learning the ins and outs after watching as many tutorials from Jeffery and other channels im not to advanced with the query builders as of yet, How would you recommend being able to insert all 5 results into the saved_estimations table if they dont already exist from the collection that is being sent to the view, That may sound like a silly question to you but the reason i ask is because the only way i know how to present the data in the view the way i need it is within a foreach loop so say for example i had a query that i want to send them to the saved_estimations table was to look like this:

DB::table('saved_estimations')->insert(array( 'project_id' => $projects->project_id, 'providers_id' => $providers->providers_id, 'category_id' => $projects->category 'bid_price' => BidsTable::orderBy('bid_price', 'desc')->first()->bid_price ));

I think it would cause issues trying to insert the 5 given results that im refering to if the query was to look something like the above am i right in what im thinking?

Much appreciate your time for helping out, Thanks.

Birdy started a new conversation Insert To Data Base On The Fly From Dynamic Content

Hi all,

I’m creating a small application for a specific industry where there are two kinds of end users, a provider in basic terms (A seller) and a user in basic terms (A Buyer).

The user visits the site and requests a free instant quotation/estimation for the service they require, my whole goal for the project is to enable automation for the providers, this is so a provider can send estimations based on the budget the user selects during the form process.

So if a user selects a budget of let’s say £200, The provider will have a default estimation set for that price range within their account management dashboard.

To make it fair we only show 5 estimations to the user per quotation request and we do this by using the random function shipped within laravel and then use the orderBy function to refactor the view in desc order.

The only problem I have is that I’m not advanced with laravel as of yet I’m un sure as to how I can insert the visible 5 estimations provided to a database named saved_estimations so when the user comes back to their account and clicks to view the quotation again the model and controller does not reorder the list in any way from the orderBy or random functions.

So in other words I either only want this to happen once per project id and save the selected 5 providers id's and their estimated prices to a table or if there is another simple way round it as in my view I use a foreach loop to loop through the collect of 5 random selected providers ordering their estimated prices in a descending order.

Any input or advice would be greatly appreciated on this.


16 Feb
3 years ago

Birdy left a reply on L5.2 Elequent Relationships - Really Struggling On This :(

Ok i have finally resolved the issue by changed the name of the function to the same exact name of the database, is this a bug because it does not work at all for me in 5.2 without having the name of the function the same as the db.

here is my end code and my database is named users

public function users() {

    return $this->belongsTo('App\UserAccounts');


also i have tried to change the name of the function from users to something else with the following attempts and it will not work at all..

public function owner(){

    return $this->belongsTo('App\UserAccounts', 'users_id', 'id');


2nd try:

public function owner(){

    return $this->belongsTo('App\UserAccounts', 'users_id');


Hope this helps someone else who comes accross the same issue.

Birdy left a reply on L5.2 Elequent Relationships - Really Struggling On This :(

im getting this error now :(

Trying to get property of non-object (View: C:\xampp\htdocs.................\job\dev2.blade.php)

Birdy left a reply on L5.2 Elequent Relationships - Really Struggling On This :(

jlrdw, I have read the docs and the tutorials from Jeffery plus youtube, I sincerly dont understand where on earth i am going wrong :(

Sithu, I have tried to use it with the () but i get an error.

right now i have even tried to use the method on a single row using find(1) and fetching the order record with the id of 1 and trying to get the owner method to work from that but i just get a blank white page :(

Birdy started a new conversation L5.2 Elequent Relationships - Really Struggling On This :(

Hey all,

Im really struggling on elequents relationship interacts where you reference onetomany and belongsTo.

I have watched tutorial after tutorial but when you have been struck in the same part of your app for several hours, Your mind becomes over whelemd and i am no doubt missing the most obvious however at the moment in time it seems impossible for me to resolve my issue.

I have even created a new database, model, controller, views ect and the error message always seems to be around the same message, Here is my error i am getting:

Undefined property: Illuminate\Database\Eloquent\Collection::$owner (View: C:\xampp\htdocs\public\views\job\dev2.blade.php)

i have 2 basic database tables set out like so just for testing: -- Users -- id (INT) name (VAR), email (VAR),

-- Orders -- id (INT), user_id (INT), price (VAR), location (VAR)

in my orders table i am referencing user_id on the users table as my forign key and Both the the ID tables from users and orders are set to unsigned and auto-increment.

simple function in routes:

Route::get('/orders', function(){ $orders = App\ShowOrders::all(); return view('job.dev2', compact('orders')); });

on my dev page i simple use {{ $orders }} to spit out the 4 dummy orders i have.

i have then tried to do the following in my orders model:

class ShowOrders extends Model { // Protected table name protected $table = "orders";

// Fillable values that are allowed to be mass a signed by the end users.
protected $fillable = [];
// Protected hidden fields such as, Password and remember me token!
protected $hidden = [];

public function owner()
    return $this->belongsTo('App\Users', 'users_id', 'id');       <--- Tried this
    return $this->belongsTo('App\Users', 'users_id');       <--- Tried this also
    return $this->belongsTo('App\Users');       <--- And also Tried this!

I have then tried to refernce this by calling

{{ $orders->owner->id }} or {{ $orders->owner->name}}

No matter what i do i get the error message :(

i have tried to use it within a foreach like so:

foreach($orders as $order) {{ $order->price }} <-- echos the price of the table fine but when i try to refer to the owner of the row for example:

{{ $order->owner->id }} or {{ $orders->owner->name }}

it still doesnt work :(

After about 8 hours of just about going insane, I would be extramly greatfull for some support guys, I feel like starting the app from scratch as my head is going to explode from it all so i would it would be very appreciated if i could get some help to get this finally sorted.


03 Feb
3 years ago

Birdy left a reply on Desperately Need Help With An Eloquent Relationship.

Finally after following this video i have now resolved the issue:

However this is how i have come to resolving the issue, I am skeptical if or not this way of resolving what i faced is pratical enough or if i should use a function such as: return $this->hasMany('

Route::get('/', function() {

$articles = \App\article::all();
foreach($articles as $article){
    $user = App\users::find($article->user_id);
    echo $article->title . ". Posted by ". $user->firstname . "<br />";


This resolves the fact i can now display the relevant users name but i would still prefer to use a faction, what are your thoughts?

Thanks for taking time out to give advice and input, Its much appreciated.

Birdy left a reply on Desperately Need Help With An Eloquent Relationship.

Hi simon, i did not originally have user_id i added that in during my fustration to see if that made a difference, Originally the only table containing user_id was the posted_articles table directly after the id column.

in posted_articles table when you click the id of 1 within the user_id column you are linked directly to id 1 within the users_profiles table however it still does not work, Also when i checked within tinker to see if that spit any further notes out, all i got back was an empty array of [] when trying to refer to the relationship as jeffery does within the L5 fundamentals video.

Birdy started a new conversation Desperately Need Help With An Eloquent Relationship.

Desperately need help with an Eloquent relationship.

After watching several of Jefferys videos over and over again, I can not for the life of me think why on earth my Eloquent relationship is not working, I have even tried to copy the exact code Jeffery has written out, Followed other peoples tutorials on youtube and no matter what i can not get the damn thing to work, However one must stress that as a novice coder i imagine i am doing something that is just a simple mistake.

After removing all my code and starting with the bare bones, Here is what i currently have.

User.php (Model)

namespace App; use Illuminate\Database\Eloquent\Model; class User extends Model { // Protected table name protected $table = "users_profiles";

public function articles() {
    return $this->hasMany('App\Article');


Article.php (Model)

namespace App; use Illuminate\Database\Eloquent\Model; class Article extends Model { // Protected table name protected $table = "articles_posted";

public function user() {
    return $this->belongsTo('App\User');


Inside my databse i have two tables with several collumns,

Table 1 = users_profiles Table 2 = articles_posted

inside table 1, Just some of the collumn names are as follows:

id, user_id, name, telephone and so on....

Inside table 2 (articles_posted) i have similar collumns id, user_id, article_name, article_body

When i load the tables within phpmyadmin a row is similar to the below:

User Profile Table Example: id user_id name telephone 1 1 Daniel 01234567890

Articles Posted example: id user_id article_name article_body 1 1 My First Article Love Articles 2 1 My second Article Articles drive me insane!

In phpmyadmin it allows me to click on the user_id, in this case the ID of ('1') within the articles table and it links to the users_profiles table taking me to the user with the profile id of 1 so i believe the database is configured correctly and referencing the correct collumn names.

What i am trying to achieve is that when a user posts and article, It can be refered to using the correct relations such as:


And it will display all the articles with the ID matching the users id, Not only that but also when an article is posted, if you was to refer to the posting user as: $user->user_id then you would just be displaying the number 1 in the case, However i would like to display the users name and have Eloquent do the work in the background so for example if i was wanting to display the users name, Eloquent would get this from the function based on the users_id.

I am totally lost with this at the moment.. I have been trying to solve the problem for 4 hours now and i honestly can not figure out whats causing it to fail.

I am hoping one of you guys with more experience would be kind enough to lend a helping hand to resolve the issue i currently face, I would be very greatfull and it will be much appreciated.


14 Jan
3 years ago

Birdy left a reply on New To Laravel: Make View Or Return View For Dynamic Cotent And Best Seo Results..

Basically i mean say for example my web application contains the following pages:

index.blade.php <-- Homepage my-account.blade.php <-- My Account page to edit my profile and view other account related info profile.blade.php <-- Users Profile page just like: @Birdy" target="_blank"> projects.blade.php <-- The Project i have posted for a freelancer to bid on. freelancers.blade.php <-- This will be a list of all the freelancers usernames where the database will loop through and display like to following example

  1. Birdy
  2. Lara
  3. Steve
  4. Dan
  5. James and so on... (These will href through to the users profile id where when a user visits the users profile for example @Birdy" target="_blank"> it will render that specfic users details on the profile.blade.php page)

So my question is, Will this be automatically indexable to search engines so for example will my profile (@Birdy)" target="_blank"> and every other users profile be indexed when using 1 page known as: profile.blade.php and rendering it with dynamic content as apose to a specfic page like: birdy.blade.php and have the page pull the content from the database.

Here is a example:

A project posted a while back on and is in the index:

Do some Excel Work | Data Entry | Data Processing | Excel › Jobs › Data Entry 'Do some Excel Work' job on Freelancer. Work on this job or post your own for free!

And Another example:

Get Traffic to my Website - Freelancer › Jobs › Internet Marketing 'Get Traffic to my Website ' job on Freelancer. Work on this job or post your own for free!

So what im getting at is, Will or any similar website use the make view function when posting a job or will they have just one page like i mention above and render that page with specfic database content and just return the view.

Or would you open up your views/projects folder and see that there is not just one view named: projects.blade.php but loads of them going like once they have been posted / created.

project1.blade.php project2.blade.php project3.blade.php project4.blade.php project5.blade.php

Does this make it more confusing or have i managed to get accross what it is i mean? Thanks for taking the time out to comment i appreciate it.

Hopefully i can get accross what it is i mean!


Birdy started a new conversation New To Laravel: Make View Or Return View For Dynamic Cotent And Best Seo Results..

Hi All, I hope i have posted under the right topic as i am new to laracasts and also laravel within its self.

Im currently building my first laravel application, The current question that is within the back of my head is what would be the best practise for seo results (I hope it makes sense to people reading this!).

If you take for example, When ever someone on there posts a project they need completing along with freelancer profiles, They are instantly submitted to search engines for indexing.

To be able to follow suit here and have my application achieve indexing on both projects posted and members profiles, How would you have laravel render the pages?

Would you use a return view function and literally insert the data into the view from the database, Or does the make view function create a static page specifically for that content and then uses the database to keep the dynamic content up to date?

I hope this has not left people reading bamboozled and thinking what on earth am i talking about, As a newbie to laravel i am somewhat out of my league and unsure to what terms i should be referring to.

I look forward to your input, I hope i can get some insights on what the best approach would be.