Cruorzy

Cruorzy

Member Since 1 Year Ago

Alkmaar

Experience Points 25,960
Experience Level 6

4,040 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 155
Lessons
Completed
Best Reply Awards 13
Best Reply
Awards
  • 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.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    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.

08 Jul
1 week ago

Cruorzy left a reply on How Can I Create A Cms With Larave?

These are not really laravel specific questions so a lot of answers may already been given on google. Just do some searches should help you bring to new idea's also looking at a other CMS might be helpful.

Octobercms uses Laravel but there are many others that don't and you can learn from.

13 May
2 months ago

Cruorzy left a reply on How To Upload Migration To My Sql Server

Can't really understand try typing some more letters and sentences to explain it better.

Cruorzy left a reply on PHP Vs Python- Which Is The Best Programming Language For Development?

It's like asking what is the best kind of fruit?

It depends......

There is no clear answer to this.

Someone will pick a banana because he finds it tastes the best, the other one will pick a apple since he believes it's the healthiest. And both of them never tried ALL the fruit.

08 Apr
3 months ago

Cruorzy left a reply on Checkbox Is Checking Another Checkboxes With Same Values - Vue

The short answer why this happens is that the value of the checkbox gets stored in the array named "itens". Vue will check on change which value is in the array, if the array holds the value of the checkbox then its marked as selected.

The problem when you click 5 that 2 other checkboxes holds the same value so it assumes for all 3 that its checked.

Now you know the problem, i'll encourage you to solve it. Giving the answer would be a bit too easy, this is a great way to learn.

26 Mar
3 months ago

Cruorzy left a reply on Play Youtube Private Video On Laravel 5.1

They will be always downloading the video, i'm not sure since this is on my research list. But what I think people are doing is chopping up the video in real small strange files and feed that to the browser.

Maybe try google for a bit?

20 Mar
4 months ago

Cruorzy left a reply on How To Set Multiple Domain Names On 1 Nginx Server ?

Does you nginx.conf include include /etc/nginx/sites-enabled/*; at all?

Cruorzy left a reply on Send Password Reset Link Is Not Working.

use Notifiable; probably?

Cruorzy left a reply on Laravel Training

hi my name is cruorzy. I just got to work successfully

19 Mar
4 months ago

Cruorzy left a reply on Videos Are Not Playing In Google Chrome

I love how much useful information this posts has.

Come back and try again.

11 Mar
4 months ago

Cruorzy left a reply on Laravel Vue, How To Npm Run Serve

mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css')
   .browserSync(process.env.APP_URL);

Then run npm run watch

Cruorzy left a reply on Searching Laravel Forum

@vandan I think you don't understand the post. :-)

08 Mar
4 months ago

Cruorzy left a reply on Laravel

Answer above should help you looking for it.

You are making bad topic posts, the titel doesn't say anything what it is about. And.... you are not showing code. Put some effort in your posts like people put effort and time in trying to solve you post.

07 Mar
4 months ago

Cruorzy left a reply on How To Protect Specific Areas With Own Id/password?

Couldn't you do this with just regular idea of permissions per user and group?

Bob just created a event gave specific people access with a permission to the event, and give other people the access to check in attendees?

06 Mar
4 months ago

Cruorzy left a reply on Laravel Extremely Slow

Had the same issue, but I was monitoring it with Laravel debug bar. In production it was extremely fast, try seeing if it's a package or code that is runned everytime.

Load up a new project test the same thing there etc.

04 Mar
4 months ago
18 Feb
5 months ago

Cruorzy left a reply on Redirect To The Desired Page When Authenicated

Pretty sure that comes with Laravel out of the box.

12 Feb
5 months ago

Cruorzy left a reply on Laravel Project Inside Another One

I was like whyyyyy, but I get your goal.

You want indeed to register some sort of subdomain but is not required too. this can be achieved with something called

"Virtual Hosts" on apache "Server blocks" on Nginx

Google them, read/watch some things about it. then make a map structure like the following.

  • sites
    • website1
      • public
    • website2
      • public
08 Jan
6 months ago

Cruorzy started a new conversation New Posts Are Always 6 Hours Ago.

When the big laracast update happened I noticed that a new post always said 'posted 6 hours ago', I've seen a post that they would were looking in to it so I thought not to bother and wait for a fix.

But I still got the issue, it's always 6 hours ago. any information if this was solved?

07 Jan
6 months ago

Cruorzy left a reply on Launching Laravel On A VPS

Just read upon those subjects in general, make sure you install Nginx/Apache PHP and MySQL/MariaDB.

Configuration is just a case of using google, with a few exceptions.

03 Jan
6 months ago

Cruorzy left a reply on Slug Route

Why don;t you carefully read this https://laravel.com/docs/5.7/routing

27 Dec
6 months ago

Cruorzy left a reply on Different Access

This is already build-in before asking these kind of questions which are almost needed in every project there is a good chance a video exist about it https://laracasts.com/series/laravel-from-scratch-2018/episodes/27 this probably does not answer your question straight away.

There is multiple ways of doing this, I would suggest to look a few videos up and gather some idea's.

20 Dec
7 months ago

Cruorzy left a reply on How To Verify Online Reservation User And Inform Admin Via Email?

It's quite easy if you know the basics of PHP and Laravel, so I'll advice to watch a few videos.

Get into it for a few hours or days, then develop this app.

The only thing you would need to think about is how you want to store those verification codes since you don't use a database. You can actually do SQLLITE which doesn't require a whole database server but its just a simple file which laravel already supports.

Cruorzy left a reply on Iterating Through A Collection Of JSON Objects After A Switch Statement

@patwan

This code right here, returns the exact same code as...

//Switch
            switch ($allArrayKeys[0]) {

                case 'national_sales':
                  $result = $resp;
                 break;

                case 'regional_sales':
                  $result = $resp;
                 break;

                case 'agency_sales':
                  $result = $resp;
                  break;

                case 'unit_sales':
                  $result = $resp;
                  break;

                case 'agents':
                  $result = $resp;
                  break;
            }

This code.

$result = $resp;

You never do anything with $resp it always returns the value is already hold no matter the kind of request.

19 Dec
7 months ago

Cruorzy left a reply on Add New Methods To A Resource Controller In Laravel

@franzag you can mark @realrandyallen that he gave the best answer, it's quite nice to do.

Cruorzy left a reply on Guys Need A Suggestion In Validation In Javascript

I don't know anything about the Javascript package but what I do for form request which is not the most elegant solution but works for me until I find something new. (So if anyone else has a idea please tag me) is the following.

I create for every create and update a form request, name them something like CreateImage and UpdateImage. Luckly haven't found the need for Delete requests but may need them in the future.

My example would be for creating a user.

CreateUser.php

class UserCreate extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        // Call the static method below
        return self::getRules();
    }
    
    /**
     * Set the validation rules that apply to the request.
     * The reason for creating a static method is that it can be called from anywhere quite elegantly
     * Also keeping the old rules() method so laravel does not break behind the scenes.
     * @return array
     */
    public static function getRules()
    {
        return [
            'first_name' => 'required|string|max:255',
            'last_name' => 'required|string|max:255|nullable',
            'email' => 'string|email|max:255|nullable',
            'account_active' => 'required|boolean',
        ];
    }
}

In the controller you can still call the FormRequest like you used too but also call the like this.

UserController.php

protected function store(array $data)
    {
        // Maybe even make a helper function for this
        $data  = \Validator::make($request->all(), UserCreate::getRules())->validate();

        User::create([
            'first_name' => $data['first_name'],
            'last_name' => $data['last_name'],
            'password' => 'somerandompassword',
            'email' => $data['email'],
            'account_active' => $data["account_active"],
            'reset_password' => \Carbon\Carbon::now()->toDateString(),
        ]);

        return redirect()->route('user.index');
    }

Then the admins can update a user to force a password reset, which I simply used the update method for since other information is updateable too, like the name and email. So what I need is the old rules of UserCreate and a new rule for the 'reset_password' column.

This is how I do that.

NOTE : I can't define it in the create since I don't wan't them to do ANYTHING with 'reset_password' column till we created the user.

UserUpdate.php

class UserUpdate extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        // Call the static method below
        return self::getRules();
    }
    
    /**
     * Set the validation rules that apply to the request.
     * The reason for creating a static method is that it can be called from anywhere quite elegantly
     * Also keeping the old rules() method so laravel does not break behind the scenes.
     * @return array
     */
    public static function getRules()
    {
        // Merges the 2 array's do I don't have to duplicate the UserCreate rules.
        // The reset_password is a boolean since it's a html checkbox, will be futher converted to date in the controller.
        return array_merge([
            'reset_password' => 'nullable|boolean',
        ], UserCreate::getRules());
    }
}

and call this in the update method as following

UserController.php (again)

public function update(Request $request, $user_id)
    {
        $data = $request->validate(UserUpdate::getRules());
        
        $user = User::find($user_id);
        
        if(isset($data['reset_password']) && $data['reset_password'] == 1) {
            $data['reset_password'] = \Carbon\Carbon::now()->toDateString();
        }
        
        $user->update($data);
        
        return redirect()->route('user.edit', $user->id)->with('flash', "{$user->fullName()} has been updated.");
    }

Cruorzy left a reply on Guys Need A Suggestion In Validation In Javascript

The issues you have with displaying a error message and refilling data already exists in Laravel with the FormRequest and the old() function.

Why don't you watch a few video's on the subject? https://laracasts.com/search?refinement=type&name=series

Simply go to that link uncheck series check episodes look for validation, watch and enjoy.

18 Dec
7 months ago

Cruorzy left a reply on SQLSTATE[HY000]: General Error: 1364 Field 'album_id' Doesn't Have A Default Value

This is kind of confusing to me even tho i'm dutch.

Why has the Album a column named "foto"? A album consists of many photo's that are defined in the Foto Model/Table, if this is meant to be some sort of thumbnail I would name it differently.

I wouldn't make a seperate seeder for the photo's i would just do that in the AlbumSeeder

class AlbumsTableSeeder extends Seeder {

    public function run() {

        // Array of the albums to be created
        $albums = [
            ['foto' => 'Waterval2.jpg', 'naam' => 'Mother Nature'],
            ['foto' => 'Vlinder.jpg', 'naam' => 'Black & White'],
            ];
            
        // Loops over the array and create te albums
        foreach($albums as $album) {
            $newAlbum = \App\Album::create($album);

            //Creates photo's that are linked to the album
            $newAlbum->albumImages()->save([
                'foto' => 'Naam.jpg'
            ]);
        }
    }
}

You could wrap the image creation within a FOR statement with a RAND(1, 10) for multiple "random" amount of images

The code was not tested, hopefully this is a new idea for you.

14 Dec
7 months ago

Cruorzy left a reply on Error In Shiow.blade

@vajid spotted it,

return redirect()->route('posts.show', $post->id);

Could solve this

Cruorzy left a reply on Error In Shiow.blade

I'm guessing you got a link to the posts.show route somewhere (maybe navbar?) without having the arguments defined like $post->id

Cruorzy left a reply on Laravel Validation Session Expired

Not sure, excellent troubleshooting will be to place a few dd(); after and before the validation, and see what gets accepted ans how far the excecution comes.

Maybe remove a few rules and see what rule gives you the obstacle.

Cruorzy left a reply on Laravel Validation Session Expired

@geekshubh if you use the Form::open method yes.

Cruorzy left a reply on Laravel Validation Session Expired

Did you maybe forget that sweet @csrf in your form?

Cruorzy left a reply on Create Package

If you say "I did it before with laravel 5.6 , Php 7.1 and it was working fine."

Then i'm sure you'll figure it out with google, there is nothing scary about trying.

Cruorzy left a reply on LOGIN ROUTE PROBLEM

Why don't you guys wait and see if he gives enough information to actually earn our help?

05 Dec
7 months ago

Cruorzy left a reply on HTTP ERROR 500

I see a log folder, how about using it to read the logs? Since its a internal server error.

04 Dec
7 months ago

Cruorzy left a reply on Create Package

So what is the question exactly?

20 Nov
8 months ago

Cruorzy left a reply on Side Projects???

Work with multiple people on a project or try too, keeps the fun in it. Also don't buy new games, they will delay any progress with a few weeks to even a few months.

Anybody wants to trade an Oddish for a Bellsprout?

Cruorzy left a reply on Latest Records

Next time tell us what you tried, now I have to assume to mean on eloquent

https://laravel.com/docs/5.7/queries#ordering-grouping-limit-and-offset

08 Nov
8 months ago

Cruorzy left a reply on Call To A Member Function Where() On Null

True about what the guys above are saying i missed that, also 1 of your forelse has no empty, its probably throwing an error because of that.

@forelse ($requisitions as $requisition)
    @forelse($requisition->activities as $activity)
        <tr>
            <td>{{ $requisition->schools->school_name }}</td>
            <td class="translate">{{ $requisition->id  }}</td>
            <td class="translate">{{ $requisition->schools->national_number_founder  }}</td>
            <td>{{ $activity->group->group_name  }}</td>
            <td>{{ $requisition->schools->type  }}</td>
            <td class="translate">{{ $requisition->schools->phone  }}</td>
            <td>{{ $requisition->schools->type }}</td>
            <td>
                <div class="btn-group btn-group-xs">
                    <a  class="btn btn-success btn-xs" data-toggle="modal" data-target="#requisition">Approved</a>
                    <form class="btn-group" action="{{ route('requisitions.unapproved', ['id' => $requisition->id]) }}" method="post">
                        {{ method_field('PATCH') }}
                        {{ csrf_field() }}
                        <button type="submit" class="btn btn-danger btn-xs">Disapproval</button>
                    </form>
                </div>
            </td>
            @empty
                No activities for this requisition
        </tr>
    @endforelse 
@empty 
No requisitions
@endforelse

Cruorzy left a reply on Call To A Member Function Where() On Null

In your blade template do this

@forelse($requisitions as $requisition)

  • {{ requisition }}
  • @empty

    There are no requisitions, please go back

    @endforelse

    06 Nov
    8 months ago

    Cruorzy left a reply on Sudo Command Not Found

    @imre08 when you reply try to tag the user.

    Also the hardware doesn't matter, in my experience when you hire a dedicated server you should have access to the root user to indeed install 'sudo' and configure it if you like to.

    If you don't have access to the root user you are way to limited and i'll also suggest moving, because you are simply restricted from doing almost anything.

    So ask how you can find the root credentials.

    Cruorzy left a reply on Sudo Command Not Found

    Are you currently logged in as a normal user or as root? Which dist of linux is it?

    01 Nov
    8 months ago

    Cruorzy left a reply on SQLSTATE[42S02]: Base Table Or View Not Found

    have you created a migration for that table and ran php artisan migrate

    29 Oct
    8 months ago
    25 Oct
    8 months ago

    Cruorzy left a reply on Check Box Is Selected

    Do you mean in js validation or laravel validation?

    else if you mean the issue where you don't have the value at all when it is not checked then simply make a hidden input, when the checkbox is checked it overwrites the hidden one.

    <input type="hidden" name="agreed" value=0>
    <input type="checkbox" name="agreed" value=1>
    
    22 Oct
    8 months ago

    Cruorzy left a reply on Why Doesn't Jeff (Way, Not Bridges) Use UserController In Auth Tutorial?

    Not sure which episode it is, but he probably makes the AuthController because when you run php artisan make:auth it creates that controller for you.

    Just to keep it simple

    18 Oct
    9 months ago

    Cruorzy left a reply on Why Do We Have To Execute Make:auth On A Fresh Installation?

    git commit -m "I might break stuff so i'll use git to be safe" then php artisan make:auth

    If you enabled it from your editor you can see all the changes that the command made, it basicaly does some in the web.php create a few views and controllers.

    Cruorzy left a reply on Create Vendor Folder

    composer install for development composer install --no-dev for production

    Cruorzy left a reply on What Am I Doing Wrong? Arrrgggh Trying To Get Property Of Non-object

    make sure you use views according to the action like 'user.show' or 'user.create' like the resource routes. (https://laravel.com/docs/5.7/controllers#resource-controllers)

    public function show(User $user)
        {
            return view('user.show', ['user' => $user]);
        }