Sam

Sam

Web Developer at Dash Group SW

Cornwall, United Kingdon

Member Since 4 Years Ago

Experience Points 6,285
Experience
Level
Lessons Completed 70
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.

31 Jan
1 year ago

Sam started a new conversation Local Development Setup

Hi folks,

Just wondering if any of you work within an 'agency' environment with many different projects across a number of platforms. For example the digital agency I have just made a move to has sites based across Wordpress, Laravel, Bespoke PHP/MySQL and Magento thrown in for good measure.

At the moment there is nothing setup in the way of a local development platform and everything is developed onto a 'local' server connected to via SMB - imagine the pain this causes. Now some may say run a mile etc etc but realistically this is why I have been brought in...to move the development and processes into the 21st century.

Obviously Im aware of Laravel Valet & Homestead and heck I even sometimes fallback to MAMP (im a Mac user) but was wondering how or what you would choose as a local development platform - bearing in mind this platform would have to encompass several different projects that may be legacy (old php versions etc). The latter point alone from what I can find rules out valet or homestead, so what options does this leave me with, Docker or Vagrant boxes...?

I've done some research around docker but can't necessarily see how this would work in this sort of role as throughout the day we may be in and out of 4-5 different websites, and if I have docker right, it would be one container per project...Bearing in mind we have both front-end developers and a backend team too.

Surely I can't be the only dev to have this issue going into a new role?

Any help/advice comments to keep me sane would be great.

02 Dec
2 years ago

Sam started a new conversation Procedural Minefield - HELP!!!

Hi folks,

Needing a little advice here on a 'what would you do' situation.

So I quite clearly have a love and passion for everything Object Orientated & Laravel based, however I've recently started in a new position where their preferred development method is PROCEDURAL (gasp).

The director is very old school in terms of development as evidenced in current projects, often using Hungarian notation eg $sString = 'Hello';

With this in mind, how would you approach trying to explain the benefits of moving to OOPHP vs Procedural. Looking over projects I have my own list of benefits but just wanted to x-reference them with others that I might not have thought of already.

05 Oct
2 years ago

Sam left a reply on Another One...What Theme Is Jeffrey Using

@martinbean I wouldn't call it an obsession at all - it was the fact I literally just started to watch that video and found the colour scheme a lot easier on the eyes. When your working 8 hour days in front of a screen staring at code you need something that suits.

04 Oct
2 years ago

Sam started a new conversation Another One...What Theme Is Jeffrey Using

Hi folks,

I've tried other methods of finding out but unfortunately can't find anything, even tweeted Jeffrey.

I was just wondering what theme is being used here: https://laracasts.com/series/php-for-beginners/episodes/21

Assuming this is a sublime theme is it also available for PHPStorm

Thanks in advance

12 May
2 years ago

Sam left a reply on Valet Considerations: To Use Or Not To Use

At the moment im using Valet for those little 'trial and error' projects or just for a quick 'thinking out loud' project, loads quicker than messing about in homestead!

06 May
2 years ago

Sam left a reply on Valet - Composer Installation Failed

Ah seems I had to remove the vendor/symfony/process files and then try it...case closed

Reference: https://laracasts.com/discuss/channels/spark/spark-installer-issue

Sam started a new conversation Valet - Composer Installation Failed

Hi folks,

Managed to install Valet on my MBP last night with no issues, however now trying to install it on work Mac at the moment and im getting the following when I run the composer line:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install laravel/valet v1.0.9
    - Conclusion: don't install laravel/valet v1.0.8
    - Conclusion: don't install laravel/valet v1.0.7
    - Conclusion: don't install laravel/valet v1.0.6
    - Conclusion: don't install laravel/valet v1.0.5
    - Conclusion: don't install laravel/valet v1.0.4
    - Conclusion: don't install laravel/valet v1.0.3
    - Conclusion: don't install laravel/valet v1.0.2
    - Conclusion: don't install laravel/valet v1.0.1
    - Conclusion: remove symfony/process v2.6.1
    - Installation request for laravel/valet ^1.0 -> satisfiable by laravel/valet[v1.0.0, v1.0.1, v1.0.2, v1.0.3, v1.0.4, v1.0.5, v1.0.6, v1.0.7, v1.0.8, v1.0.9].
    - Conclusion: don't install symfony/process v2.6.1
    - laravel/valet v1.0.0 requires symfony/process ~2.7|~3.0 -> satisfiable by symfony/process[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.2, v2.8.3, v2.8.4, v2.8.5, v3.0.0, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5].
    - Can only install one of: symfony/process[v2.7.0, v2.6.1].
    - Can only install one of: symfony/process[v2.7.1, v2.6.1].
    - Can only install one of: symfony/process[v2.7.10, v2.6.1].
    - Can only install one of: symfony/process[v2.7.11, v2.6.1].
    - Can only install one of: symfony/process[v2.7.12, v2.6.1].
    - Can only install one of: symfony/process[v2.7.2, v2.6.1].
    - Can only install one of: symfony/process[v2.7.3, v2.6.1].
    - Can only install one of: symfony/process[v2.7.4, v2.6.1].
    - Can only install one of: symfony/process[v2.7.5, v2.6.1].
    - Can only install one of: symfony/process[v2.7.6, v2.6.1].
    - Can only install one of: symfony/process[v2.7.7, v2.6.1].
    - Can only install one of: symfony/process[v2.7.8, v2.6.1].
    - Can only install one of: symfony/process[v2.7.9, v2.6.1].
    - Can only install one of: symfony/process[v2.8.0, v2.6.1].
    - Can only install one of: symfony/process[v2.8.1, v2.6.1].
    - Can only install one of: symfony/process[v2.8.2, v2.6.1].
    - Can only install one of: symfony/process[v2.8.3, v2.6.1].
    - Can only install one of: symfony/process[v2.8.4, v2.6.1].
    - Can only install one of: symfony/process[v2.8.5, v2.6.1].
    - Can only install one of: symfony/process[v3.0.0, v2.6.1].
    - Can only install one of: symfony/process[v3.0.1, v2.6.1].
    - Can only install one of: symfony/process[v3.0.2, v2.6.1].
    - Can only install one of: symfony/process[v3.0.3, v2.6.1].
    - Can only install one of: symfony/process[v3.0.4, v2.6.1].
    - Can only install one of: symfony/process[v3.0.5, v2.6.1].
    - Installation request for symfony/process (locked at v2.6.1) -> satisfiable by symfony/process[v2.6.1].


Installation failed, reverting ./composer.json to its original content.

What am I missing here?

15 Mar
2 years ago

Sam started a new conversation Socialite - Graph API Data

Hi all,

Just wondering if anyone has successfully come up with a way to get additional data when using Socialite?

I understand that Socialite returns basic information on the user but doesn't give you the opportunity to define custom endpoints such as 'Users Likes'. Obviously there would be permissions that would have to be verified by the user, but I can't even see how we would request this through socialite.

Is it possible or would it be best off looking at a different package...can anyone recommend one?

08 Mar
2 years ago

Sam left a reply on Adding Different Records - Relationship

Hey @DPJack,

Thanks for jumping in here, just wanting to make sure im setting up my relationship correctly.

A Customer can have many Bookings - So therefor a Customer hasMany Bookings and a Booking belongsTo a Customer?

Surely the above would constitute a one-to-many relationship?

Sam started a new conversation Adding Different Records - Relationship

Hi all,

Just need a little sense-check.

So im working on a bookings system and when payment has been made we then add the data to the database, however we allow customers to make multiple bookings via their login etc so we have a Customer model and a Bookings model.

Within the booking I have defined 'customer_id' as a field which references the id on the 'customers' table - ok simple.

My question is, what is the best way of dealing with this in terms of creating the records. Do I:

$new_customer = Customer::create($customer);
$booking = Booking::create($booking);

$booking->customers()->attach($new_customer->id);

Or am I getting this completely wrong?

03 Mar
2 years ago

Sam left a reply on Best Laravel CMS For Ecommerce

As the guys have said above, there are plenty of packages out there for a Ecommerce enabled Laravel site, here's one of them, https://aimeos.org/project/laravel-ecommerce-package/ I personally have never used it and can't vouch for it but it looks OK?

02 Mar
2 years ago

Sam left a reply on Session Forget - Multi Dimensional Array

Ah dot notation...

Seems to work - is this documented anywhere?

Sam started a new conversation Session Forget - Multi Dimensional Array

Hi all,

So I have added some data to my session via

$array = ['vehicle_availability' => ['costs' => $costs]];
Session::push('booking', $array)

If further down the line I wanted to 'remove' the 'vehicle_availablity array from the session how would I go about this?

Using the PHP global $_SESSION I believe the way to have done it would be:

unset($_SESSION['booking']['vehicle_availability']);

Just unsure of the 'laravel way'

18 Jan
2 years ago

Sam started a new conversation DB Query - Can This Be Simplified

Hi all,

I was wondering if the following:

$quaz = DB::select("SELECT count(*) AS total  FROM reservations WHERE
            vehicle_id = " . $vid . "  AND
            ((('" . $collectDateTime . "' BETWEEN collect_date AND ADDTIME(return_date, '" . $thistime . "')) OR
                ('" . $returnDateTime . "' BETWEEN collect_date AND ADDTIME(return_date, '" . $thistime . "'))) OR
        (collect_date BETWEEN '" . $collectDateTime . "' AND '" . $returnDateTime . "') OR
        (ADDTIME(return_date, '" . $thistime . "') BETWEEN '" . $collectDateTime . "' AND '" . $returnDateTime . "'))");

Could be simplified using the ->whereBetween method at all or even just a little friendlier. Basically it's trying to see if there's any conflicts in a reservation table between 2 dates.

TIA

06 Jan
2 years ago

Sam started a new conversation Pages Routing

Hello all,

Just wondering if anyone could help out here.

Im just about to add a pages controller to my application which will basically allow me to add, edit and show pages, eg about us, contact us, privacy etc.

I was wondering what the best way to do this would be along with the capability of being able to nest pages should I wish?

TIA

11 Dec
3 years ago

Sam left a reply on Showing SweetAlert On Login

I MUST USE THE SEARCH FUNCTION

public function authenticated( \Illuminate\Http\Request $request, \App\User $user ) {
    flash()->success( 'Logged in', "You have been logged in, {$user->name}" );
    return redirect()->intended($this->redirectPath());
}

Sam started a new conversation Showing SweetAlert On Login

Hi there,

I was wondering what method I would need to extend in order to show a flash message when a user logs in, basically how jeffrey does here on laracasts.

I am using the sweet alert javascript library and have setup a custom helper to achieve it as per jeffreys guidance in one of his videos.

TIA

10 Dec
3 years ago

Sam started a new conversation Form::model | Form::select - Get Pivot Information

Hello,

So I currently have a Form:model such as

{!! Form::model($vehicle_type, ['route' => 'admin.vehicle_types.update', 'method' => 'PUT', 'class' => 'form-horizontal']) !!}

With in said form I have a Form::select which allows multiple for 'extras' which is defined by a many-to-many relationship in vehicle_extras pivot table.

I have defined the following within my VehicleTypes controller:

    public function edit($id)
    {
        $vehicle_type = VehicleType::with('vehicle_rate', 'extras')->find($id);
        $extras = Extra::lists('name', 'id');

        return view('admin.vehicle_types.edit', ['vehicle_type' => $vehicle_type, 'extras' => $extras]);
    }

How can I get the extras that are currently assigned to the vehicle to appear selected in a multi-select form field?

TIA

09 Dec
3 years ago

Sam left a reply on MindBlank - Should I Pivot?

Thanks again for this however,

Extras can be assigned to more than one VehicleType?

Sam left a reply on MindBlank - Should I Pivot?

Thanks @cipsas ,

So how would I go about defining this relationship then?

As far as I understood it the relationship between vehicle_type and extra was:

class VehicleType extends Model
{
    public function extras(){
             return $this->hasMany(Extra::class);
     }
}

With the above in mind how would you attach the 'Extras' to the Vehicle type? Serialize the extras id's in a column on the vehicle_type table?

Sam started a new conversation MindBlank - Should I Pivot?

Hi all,

So, I have 3 tables

vehicle_type extra extra_type

"A vehicle_type has many extras and a extra belongs to an extra_type"

I did setup a pivot table for this however looking at it, I would need to find a belongstomany relationship for this to work with the attach method. Can anyone advise on the above?

08 Dec
3 years ago

Sam started a new conversation Music While Coding

Hey folks,

Just thought I'd gain some community insight and ask what music do you listen to when you code and does it differ from your general music tastes?

I'll start out by saying I'll often listen to Classical or Chill music but my main genre is dance/techno

Sam

04 Dec
3 years ago

Sam left a reply on IE8 Yes Or No?

I just want to say a big thank you to all of the responses, many informative and well constructed and given me a lot to go on.

Whilst I accept that a business decision does need to be made here I was also trying to look at it from a general web point of view, had it been from a business and revenue point alone it would have gone favourably in the way of ensuring it was as every bit functional as the website in chrome.

I noticed that Laracasts isn't optimised in anyway for IE8 but then again the demographic here is completely different, although places such as Tesco and Asda also don't put any special thought into IE8.

Once again, thanks again for the responses, I'll take your responses back to management and go from there!

Sam started a new conversation IE8 Yes Or No?

Hi folks,

So, I currently work full time for a large e-commerce store who are currently updating their design and modern development methods.

As it stands Im trying to push forward the business case for dropping IE8 and concentrating our time on the supported browsers. I know this subject has many different aspects of it and depends on the business case/revenue from the demographic on particular browsers etc. So let me break it down for you.

Our revenue over the past year on IE8 alone was ~£20,000 with a 6.43% of total sessions. From the last half of this year it dropped to 4.92% of total sessions. Assuming this was due to the drive towards Windows 10.

So given the stats above, what would you advise/do from a web point of view, drop it all together and forget it ever existed, make it functional & forget about the aesthetics, or make it look the best you can even if it means spending weeks on it.

Tia

28 Nov
3 years ago

Sam left a reply on Relationship Variable - Correct Way?

@JarekTkaczyk what would your approach be to do this in the controller?

This is a very rough prototype and probably something that is going to be scrapped once utilised but would rather get it right!

Sam

Sam started a new conversation Relationship Variable - Correct Way?

Hi all,

Needing a bit of a steer in the right direction:

If i have a table of users which hasMany social_accounts and within the social_accounts table 'follower_count' is stored how would I get the total amount of 'follower_account' for each user?

ie:

@foreach($users as $user)
    <div>total follow count for {!! $user->id !!} is  {!! ??? !!}</div>
@endforeach

My instinct would be to sum the value of a foreach array on

@foreach($user->social_provider as $social_provider)
    <?php $total_follow += $social_provider->follow_count; ?>
@endforeach

I accept that I may be looking at this the completely wrong way.

My controller code is as such:

public function index()
    {

        $users = User::with('social_provider')->get();


        return view('dashboard.index', compact('users'));

    }
02 Nov
3 years ago

Sam left a reply on Homestead Download Issue

Panic over, tried again and it came down fine :-)

Thanks for your time Bashy!

Sam

Sam left a reply on Homestead Download Issue

Hi Bashy,

No it's not always the same, im just wondering if it's the Wi-Fi connection here, unfortunately im on a MB Pro and don't have my ethernet adapter to test.

If you can download fine from your end I would say it's definitely a connection issue from my end!

Regards Sam

Sam started a new conversation Homestead Issue

Hi all,

I seem to be having an issue adding the homestead box to vagrant, here's the error message im getting:

==> box: Loading metadata for box 'laravel/homestead'
    box: URL: https://atlas.hashicorp.com/laravel/homestead
==> box: Adding box 'laravel/homestead' (v0.3.0) for provider: virtualbox
    box: Downloading: https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.3.0/providers/virtualbox.box
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

transfer closed with 517398432 bytes remaining to read

I have tried to download several times even with the -C flag which means it doesn't use the cached 'already downloaded' copy.

Any help would be greatly appreciated.

13 Oct
3 years ago

Sam left a reply on Socialite - Connecting Social Accounts

Hi @thomaskim, unfortunately the only information I get back from the authentication is the general user information.

When using the Graph debug this is what it returns:

  "data": [
  ],
  "summary": {
    "total_count": 346
  },
}```

You are right about the 'user_likes' scope, but 'user_friends' does not require any further permissions as is approved by default.
12 Oct
3 years ago

Sam left a reply on Socialite - Connecting Social Accounts

So after re-reading my questions they make very little sense.

Im trying to obtain a users likes from facebook. However from reading it would seem that all Socialite is good for is general authentication, not obtaining edge scopes (in facebook's terms) such as 'user_friends'.

Here's what i'd like to obtain: https://developers.facebook.com/docs/graph-api/reference/user/likes/

So my question is, has anyone managed to obtain information from any social network using Socialite using the 'scopes' method? It would seem from several StackOverflow comments and other posts elsewhere that Socialite simply doesn't allow extended scopes?

TIA

10 Oct
3 years ago

Sam left a reply on Socialite - Connecting Social Accounts

When using facebook - how can I use the scopes to get a users friends? Would I pass through 'user_friends' as a scope, if so how would I then obtain the information that's returned as when i do the following:

    {
        return Socialite::driver($provider)->scopes(['manage_pages', 'user_likes', 'user_friends'])->redirect();
    }```

It just returns the standard information
09 Oct
3 years ago

Sam left a reply on Socialite - Connecting Social Accounts

Thank you for clarifying those points.

So just to clarify further, once the user has authenticated/added to the system I won't have to re-request authentication to pull data from the social networks which in turn would update the systems database should I desire?

Basically what I'm trying to get at is, can I just access the users social data when I require once they have authenticated once on the system or do tokens etc expire?

TIA

Sam started a new conversation Socialite - Connecting Social Accounts

Hello all,

First off im going to start with a disclaimer and say that this post may seem like like a bit of a muddle and I apologise for that.

Anyway so im starting up a new little project that allows the following:

  1. User Signs Up For Account (without social media)
  2. User is then prompted to 'connect' their social media accounts, facebook, twitter etc
  3. Certain information is then obtained about the user such as DOB, Amount of Followers/Friends and their likes

Obviously there is more to the project than this but I was just wondering if Socialite will allow me to do all of the above from the social integration side of things. I know I can register a user etc but is it possible to obtain further information from a particular social network using the 'scopes' method?

Secondly, obviously we would want the users data to be updated regularly, is there anyway to do this say once a day, poll the social network sites for a users follow count/likes/post number etc or would this be reliant on the user having to login and re-authenticate?

I hope the above makes sense, I'd be more than happy to clear things up further if required.

TIA

24 Aug
3 years ago

Sam left a reply on LaraBin.com - It's Live!

Perhaps a snippet search or something along those lines?

21 Aug
3 years ago

Sam left a reply on Mailbox Monitoring

Thanks @willvincent so this would basically allow a connection to mailbox via imap that would poll for new emails and parse them on a regular basis?

20 Aug
3 years ago

Sam started a new conversation Mailbox Monitoring

Hi all,

Just wondering if anyone could provide an insight into how I might achieve mailbox monitoring within a laravel application.

What I'm after is to setup a mailbox eg: helpdesk@mydomain.com and the asking colleagues/clients to submit support requests to this email address and then for Laravel to pull through these emails.

I'm not sure if there's anything that laravel has built in to pull through the information etc?

Regards Sam

12 Aug
3 years ago

Sam left a reply on Laravel Spark

Looking awesome! Just wish it had been released a year or so a go, would have made for less headaches for a project I was working on :-) Great work!

06 Aug
3 years ago

Sam left a reply on Your Daily Website Routine

Ah sorry @kayyyy just updated original post! I always forget about the github trending page! One to bookmark!

Sam left a reply on GitHub Or BitBucket

BitBucket for me - although I have noticed a few service related issues recently in terms of performance however the team are always onto it very quickly!

Sam started a new conversation Your Daily Website Routine

Hi all,

So I've just spent the last 30 minutes of my evening trawling the internet as I often do to see if I could find some interesting and new websites that are based around my developer role and interests and it dawned on me that fellow laracasters might have their own websites they visit.

So, what sites do you visit on a daily basis from a tech/developer point of view?

07 Apr
3 years ago

Sam left a reply on CSV File Upload Request Validation

Thanks for your response and apologies for my delay in getting back to you. I have gone over my code and ensured it works correctly however it would seem that my client was trying to upload a file with the following filename items (1).csv.

This was failing the validation, for obvious reasons (I think). With the above in mind would I be best of validating the filename on the front-end (javascript) or via laravel, if it's the latter what approach should I take?

Regards Sam

03 Apr
3 years ago

Sam left a reply on CSV File Upload Request Validation

Hi @rodrigo.pedra

Yes the file does have a .csv extension. Using getMimeType() function on the file upload returns 'text/csv'

Thanks

Sam started a new conversation CSV File Upload Request Validation

Hi all,

Wondering if someone could lend a hand here. I have a form field that is used for a CSV file upload, all goes through fine however I have dropped in validation via a From Request with the following rules:

public function rules()
    {
        return [
            'csv_import'      => 'required|mimes:csv',
        ];
    }

Unfortunately validation completely fails despite using a CSV file.

Any help would be much appreciated!

15 Feb
3 years ago

Sam left a reply on Testing Laravel 5 And Way/Generator Issue

Yes, Jeffrey stated that the generators will now be archived!

06 Feb
3 years ago

Sam left a reply on Mandrill Not Working In 5.0

@nitrammit however you don't have to ditch Sublime altogether. I still use both, and I believe one of Jeffreys' videos states that he still uses both as they each have their advantages.

All of my front end work is primarily done in Sublime and all bespoke and backend development is done in PHPStorm due to the fact it makes it so easy. Yes there's a little bit of a learning curve with it and you will feel like your not using it to it's full potential but once you find the hidden features you'll wish you switched sooner!

04 Feb
3 years ago

Sam left a reply on Rejoice. L5 Si Here.

Congrats to @TaylorOtwell and the team also I think a shout should go to Jack McDade too, nice design!

23 Jan
3 years ago

Sam left a reply on L5 Beta Incoming?

Hi folks,

How do you go about updating homestead? Will this wipe all current databases etc?

@JeffreyWay what makes you say that?

Thanks

20 Jan
3 years ago

Sam left a reply on Validator - Passing Through Parameter

Hi @pmall,

Thanks for your prompt response, its greatly appreciated.

In my controller I'm calling $this->itemForm->validate( $input ); which when I use a method means that this actually fails as $this->rules within Laracasts\Validation is undefined.

How can I work around this?

Sam started a new conversation Validator - Passing Through Parameter

Hi all,

So im currently working on developing a system where a User of a company can add 'items' to a inventory.

What I need to prevent them doing is adding the same item to the inventory twice (they just adjust the quantity levels. My initial thought was to user generate an Item Code but after investigation companies obviously have their own product codes.

So basically what Im wanting to do within my ItemsForm class (which extends the FormValidator is on the 'item_name' is add validation which would state the following:

protected $rules = [
        'name'      =>          'required|unique:inventory_items,name,NULL,id,company_id, 2',
    ];

Where the 2 is in that rule I would want to pass something through like Auth::user()->company->id

If anyone can shed any light on this that would be great.