Nash

Nash

Member Since 2 Years Ago

Experience Points 76,900
Experience
Level
Lessons Completed 200
Lessons
Completed
Best Reply Awards 87
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.

10 Dec
1 day ago

Nash left a reply on How To Push A Job Into Queue?

Have you actually configured the queue driver/connection to something other than sync, e.g. database, beanstalkd, sqs or redis? Otherwise, the jobs will just execute immediately.

https://laravel.com/docs/5.7/queues#driver-prerequisites

08 Dec
3 days ago

Nash left a reply on Not Able To Deploy

It may be easier to just provision a new server and set things up from scratch if things are messed up. Here's a guide on solving public key problems in Forge.

Nash left a reply on Not Able To Deploy

That shouldn't happen. Have you added anything that requires root privileges to your deployment script?

06 Dec
5 days ago

Nash left a reply on Undefined Variable: Categories (View: E:\lara-test1\resources\views\posts\create.blade.php)

@petrit You probably mean ->with('categories', $categories) or ->with(compact('categories')). In any case, dynamic "with" variable names like ->withCategories($categories) should work just as well.

Nash left a reply on Undefined Variable: Categories (View: E:\lara-test1\resources\views\posts\create.blade.php)

You seem to be passing $categories to the posts.create view correctly but you have @section('content') twice in your view. Perhaps that could be causing the issue?

Nash left a reply on Static Methods And Method Chaining

You can use regular non-static methods and simply return $this. Laravel uses something called facades in some places to serve as a "static proxy" to your regular methods. Alteratively, you could use dependency injection.

05 Dec
6 days ago

Nash left a reply on How Can I Backup A Laravel Project To Box?

The Laravel Backup package by Spatie is really good and can back up both your files and database to any filesystem you have configured in Laravel. Laravel's filesystem [works with FTP](See https://laravel.com/docs/master/filesystem#driver-prerequisites) but you'll have to add the configuration to filesystems.php manually. Please note that FTP is not a secure protocol.

29 Nov
1 week ago

Nash left a reply on Forge Is Not Running My Migrations In My Deploy Script

It seems the default deployment script uses php artisan migrate --force...it just slipped my mind since I rarely run that command manually on the prod server.

Nash left a reply on Forge Is Not Running My Migrations In My Deploy Script

migrate:fresh drops all the tables and runs through the up methods, which is something you typically don't want to do on your production database; hence the command getting canceled. You can SSH into your server and run the command manually if you want to (it will ask for verification if you do this in your production environment).

If you just want to update the database with new tables or changes, just php artisan migrate should suffice.

Nash left a reply on Testing Commands That Die

@ARVISTO - I'm not entirely sure what you mean but you should be able to throw an exception in the constructor (e.g. throw new \Exception("Cannot instantiate command");) just fine.

27 Nov
2 weeks ago

Nash left a reply on Testing Commands That Die

Instead of die you could just have your command throw an exception or return a boolean false when the incorrect env is set and test against that.

You can test an exception like this:


public function testException()
{
    $this->expectException(SomeException::class);

    // code that should trigger the exception goes here
}

or use $this->assertFalse() for testing the boolean.

25 Nov
2 weeks ago

Nash left a reply on Laravel Github & Licensing

That depends entirely on what you want people to be able to do (or not do) with your software. Some licenses allow people to do pretty much anything while others can be very restrictive.

These links should give you a better overview of the subject:

23 Nov
2 weeks ago

Nash left a reply on .env Variables Returns Null

@lmatab You're welcome. Please mark the thread as solved to help others.

Nash left a reply on Why Isn't Laravel Core Still Type-hinted?

These tests are not that great probably

That is highly subjective but I can see your point.

Nash left a reply on Why Isn't Laravel Core Still Type-hinted?

@roborobok Yeah, I just meant that there are situations where it could be beneficial, since you were wondering if there are any potential benefits to avoiding type hints...I can't really say for the core though. Some developers are not that into type hinting and strongly typed languages and others swear by it. In the end, it's a matter of personal preference. Still, you would probably have some tests for those methods anyways.

Nash left a reply on Why Isn't Laravel Core Still Type-hinted?

There are cases where it could come in handy, for example, if you have a method that accepts a string for a single value or an array for multiple values (like many methods in Laravel do). In those cases, you couldn't use type-hinting because you can't specify multiple types. Regardless, you should still have written tests.

22 Nov
2 weeks ago

Nash left a reply on Payment Methods For A Marketplace In The EU

There's always PayPal but other than that, I'd say it varies from country to country. If you don't want to use credit cards for payment, you'll probably be looking at some sort of bank transfer service and will probably need to use some local provider. Check out some local eCommerce sites and see what they use or ask them or your bank directly.

You could also just display or email the billing information and account number to your customer and have them make the bank transfer manually, but then you'll probably have to verify all payments and orders manually, which is a bit of a hassle.

21 Nov
2 weeks ago

Nash left a reply on Forking Laravel Repo

Are you forking it because you want to contribute to the framework or because you want to change/override an existing method in the RegistersUsers trait for your application? If you only want to override a method, you can do so by making a method with the same name in the class where the trait in use.

For example, if you want the showRegistrationForm() method to behave differently in your RegisterController.php, just copy the method there and it will override the one in RegistersUsers.php

Nash left a reply on Which CSS Framework Is Laracasts Using?

The new (blue) design uses Tailwind. The old (green) used Bulma, I think.

16 Nov
3 weeks ago

Nash left a reply on Laravel Shows No Errors But Doesnt Send Mail

@AREG - You need to add and verify a real domain to send with Mailgun.

If that's not possible, you could use the SMTP driver with your own Gmail or something like that or send email directly from your server (mail driver "sendmail" or "mail"). You still need to configure DNS records (SPF, DKIM, DMARC) for the "from" domain if you send from your own server though.

15 Nov
3 weeks ago

Nash left a reply on Laravel Shows No Errors But Doesnt Send Mail

Are you still in sandbox mode and have you added your "to" address to authorized recipients in the Mailgun dashboard? The sandbox subdomain is for testing and can only send to authorized recipients.

Nash left a reply on Help With Recursion

Perhaps you could use a class variable instead?

private $some_variable = [];

...and in your method:

$this->some_variable[] = "something"; // or something similar depending on your needs
13 Nov
4 weeks ago

Nash left a reply on Paginate () Method With Errors

@DANIEL21GT - The code you pasted does not contain a variable named $users nor any pagination with ->appends()?

Nash left a reply on Paginate () Method With Errors

Are you appending "numero" to the links/query string for subsequent requests?

{{ $users->appends(['numero' => $request->numero])->links() }}

12 Nov
4 weeks ago

Nash left a reply on Auth Check Public Folder Php File?

@CODER_UZB - Just be aware that re-enabling serialization can potentially become a security risk. See my previous post.

Nash left a reply on Auth Check Public Folder Php File?

Take a look at the section on Cookie Serialization in the 5.5 (security release) upgrade guide:

https://laravel.com/docs/5.5/upgrade#upgrade-5.5.42

11 Nov
1 month ago

Nash left a reply on Looking For Best Way To Setup A VPS Server

Many VPS providers have various one-click setups for LAMP, LEMP etc, but if you are new to all this you may want to consider using a server management service like Laravel Forge (official Laravel product). Forge installs (almost) everything you need for you and lets you configure important stuff and handle deployments. You still need a separate VPS provider like DigitalOcean or AWS though.

Check out the Laracasts series on Laravel Forge: https://laracasts.com/series/learn-laravel-forge

09 Nov
1 month ago

Nash left a reply on Can You "embed" A FormRequest Object Within Another FormRequest Object?

Maybe something among the lines of this?

class SomeBulkFormRequest extends FormRequest
{
    ...

    public function rules()
    {
        $rules = 
            (new SomeFormRequest)->rules() + 
            (new SomeOtherFormRequest)->rules() 
        ;

        if ($this->input('some_field')) {
            $rules += (new SomeConditionalFormRequest)->rules()
        }

        return $rules;
    }

}

You could probably make this prettier by storing the class names in a separate array/class variable and then instantiate them dynamically and append the rules to the $rules array or something like that.

Nash left a reply on .env Variables Returns Null

If you cache the config, you can't use env() in your application (only in config files). Use config() instead and env() only in config files or don't cache the config.

If you execute the config:cache command during your deployment process, you should be sure that you are only calling the env function from within your configuration files. Once the configuration has been cached, the .env file will not be loaded and all calls to the env function will return null.

Configuration Caching

08 Nov
1 month ago

Nash left a reply on Accessing JSON In TEXT Columns

Try json_decode($value, true) if you want an associative array. See http://php.net/manual/en/function.json-decode.php

To query the column, try using a JSON column instead of TEXT and make sure your database version supports it:

Laravel also supports querying JSON column types on databases that provide support for JSON column types. Currently, this includes MySQL 5.7, PostgreSQL, SQL Server 2016, and SQLite 3.9.0 (with the JSON1 extension).

https://laravel.com/docs/5.7/queries#json-where-clauses

28 Oct
1 month ago

Nash left a reply on Laravel Ide On Android App

I'm guessing the OP wants to build their own IDE that can also compile the project (i.e. has built-in support for a compiler). A "Laravel IDE", however, would just be an IDE for PHP with some Laravel code intel and snippets. Also, since PHP is an interpreted language (as opposed to a compiled language like Java or C++), having a compiler doesn't really make sense.

09 Oct
2 months ago

Nash left a reply on How To Create Md5 Password In Php And Save To Database?

You need to check that the (hashed) password in your db equals the hashed value of the input. However, you should not store passwords as md5, it's not secure. Also, you should use prepared statements (and preferably PDO) to protect against SQL injections.

27 Sep
2 months ago

Nash left a reply on Sitemap

Try this Laravel sitemap package by Spatie: https://github.com/spatie/laravel-sitemap

Nash left a reply on Object Parsing Is Faster Or Array Parsing?

Request already is an object, so unless you specifically wish to retrieve the input as an array, you could just do request('something'), $request->input('something') or $request->something.

See the docs: https://laravel.com/docs/5.7/requests#retrieving-input

26 Sep
2 months ago

Nash left a reply on Why To Use Envoyer For 0% Downtime?

As far as I know, Envoyer creates a new installation in a separate directory when you deploy and only starts pointing there once everything is up and running. You can also easily roll back your deployments to the previous install.

Forge uses the same installation and only pulls in the changes (+ runs migrations and installs new packages), so everything is still happening to your live site in real time. This can potentially result in more downtime and trouble if something goes wrong and you have to fix it or if the update is very big, needs configuration etc.

24 Sep
2 months ago

Nash left a reply on Data Retrieving Problem

Input::all() used to be for getting request input. Try naming your model something else and set the table explicitly in your model using protected $table = 'inputs';.

Nash left a reply on Bugs On Has()

@pramanadiputra $course->lectures gives you a collection of items. $course->lectures->has(1) will check for index 1, not if the lecture has ID 1. If you have 6 items, the largest index will be 5, because array index start at 0. Check the output of dd($course->lectures);

Nash left a reply on Bugs On Has()

has() is supposed to determine whether a key exists in a collection or a relationship exists in Eloquent. It is not meant to check if a certain ID exists.

See the docs:

Nash left a reply on Htmlspecialchars() Expects Parameter 1 To Be String, Array Given

Based on your error message, it would seem that you are trying to echo out an array (instead of a string). Try dd($k->value('labelper')) and see what it gives you;

Nash left a reply on Data Retrieving Problem

Please show your code. Your error message indicates that you are not passing the variable to your view properly in your controller, e.g. return view('greeting')->with('name', 'Victoria');

14 Sep
2 months ago

Nash left a reply on Unsubscribed Two Months Ago. Still Have Access. Is Something Broken?

Those are mostly free videos. Try the Build a Forum series, they should require a subscription:

https://laracasts.com/series/lets-build-a-forum-with-laravel/episodes/1

Nash left a reply on PHP Sessions

You could probably make a custom auth driver / user provider: https://laravel.com/docs/5.6/authentication#adding-custom-user-providers

11 Sep
3 months ago

Nash left a reply on Unsubscribed Two Months Ago. Still Have Access. Is Something Broken?

@pcgben It's in the footer at the bottom of the site. There is a Support link under Discuss.

10 Sep
3 months ago

Nash left a reply on Requests Not Validating Contact Form

What does your controller look like? Are you type-hinting the ContactFormRequest class properly in the controller method? Are the form inputs named correctly in your view?

Also, these are redundant in your form request file:

use App\Http\Controllers\ContactFormRequest;
use App\Mail\ContactEmail;
use Flash;
04 Sep
3 months ago

Nash left a reply on Updating Answer - Mention User

Probably so that someone you've already mentioned doesn't receive a bunch of notifications if you decide to correct a few typos in your post?

03 Sep
3 months ago

Nash left a reply on Call To A Member Function RelStudies() On Boolean

Like the error message says, you are trying to call a relStudies() on a boolean. Your update method is assigning the return value from update() to $friend instead of the model.

Try changing this...

$friend = Friend::find($id)->update([
            'name' => $request->name,
            'gender' => $request->gender,
            'age' => $request->age,
            'state' => $request->state,
            'house_number' => $request->house_number,
            'occupation' => $request->occupation,
            'bio' => $request->bio,
            'users_id' => auth()->user()->id
        ]);

        $friend->relStudies()->sync($request->educations);

...into something like this:

$friend = Friend::find($id)

$friend->update([
        'name' => $request->name,
        'gender' => $request->gender,
        'age' => $request->age,
        'state' => $request->state,
        'house_number' => $request->house_number,
        'occupation' => $request->occupation,
        'bio' => $request->bio,
        'users_id' => auth()->user()->id
    ]);

$friend->relStudies()->sync($request->educations);
02 Sep
3 months ago

Nash left a reply on Save Html Code Inside Database

You need to escape the single quotes with a backslash \' but you should be really careful about letting your HTML contain JS like that. It may be vulnerable to XSS attacks if there's any user input involved.