Raymond

Raymond

Member Since 5 Years Ago

Baflo, The Netherlands

at Leeuwarden

Experience Points 7,800
Experience Level 2

2,200 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 390
Lessons
Completed
Best Reply Awards 2
Best Reply
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.

08 Oct
4 years ago

Raymond left a reply on L5 - Form Errors Not Showing Up?

@imJohnBon @DV

You should first do a check like this:

@if(Session::has('errors'))
...the rest what DV told you...
@endif

Raymond left a reply on [5.0] Changes To Controller -- Illuminate\Routing\Controller Removed

@mrlilley how about in a ServiceProvider? :-) I did put this in my RouteServiceProvider $this->app['view']->share('abc','def');

Raymond left a reply on [5.0] Changes To Controller -- Illuminate\Routing\Controller Removed

@Killswitch and @keevitaja, problem with the approach that @Killswitch is referring to you come stuck in the middle, I tried that also, biggest problem was, when I installed a new project thinks didn't work (examples: filters => middleware, controller), and in my opinion if something doesn't work, you want to try to get it working, it's time consuming I know that, but it is also giving me the time to learn a lot about what @TaylorOtwell is developing.

Don't think about problems, but think about (mind breaking) challenges. :-)

Raymond left a reply on [5.0] Changes To Controller -- Illuminate\Routing\Controller Removed

Let me think... I am using the latest version, it's not hard to handle, just add protected $userResolver; to Illuminate\Http\Request. And format your errors something like:

@if(Session::has('errors'))
<div class="alert alert-danger">
    <ul>
        @foreach(Session::get('errors')->all() as $error)
        <li>{{ $error }}</li>
        @endforeach
    </ul>
</div>
@endif

Also I was reading something about annotations, I don't use it at the moment just write my controllers like this:

<?php

# REGISTRATION
get('register', ['middleware' => 'guest', 'as' => 'register', 'uses' => 'RegistrationsController@create']);
post('register', ['middleware' => 'guest', 'as' => 'register.store', 'uses' => 'RegistrationsController@store']);

# LOGIN
get('login', ['middleware' => 'guest', 'as' => 'login', 'uses' => 'SessionsController@create']);
post('login', ['middleware' => 'guest', 'as' => 'login.store', 'uses' => 'SessionsController@store']);
get('logout', ['as' => 'logout', 'uses' => 'SessionsController@destroy']);

# RESET PASSWORD
get('login/reset', ['as' => 'reminder.create', 'uses' => 'RemindersController@create']);
post('login/reset', ['as' => 'reminder.store', 'uses' => 'RemindersController@store']);
get('password/reset/{token}', ['as' => 'password.show', 'uses' => 'RemindersController@show']);
put('password/reset', ['as' => 'password.update', 'uses' => 'RemindersController@update']);

Hope this will help someone :-)

07 Oct
4 years ago

Raymond left a reply on Middleware Instead Of AuthFilter?

i found a different way :-)

get('/', ['middleware' => 'auth', 'as' => 'home', 'uses' => 'PagesController@home']);

Raymond left a reply on Middleware Instead Of AuthFilter?

maxccarvalho could you share it?

Raymond left a reply on Whitespace Problems With Route

@kyos you could do Str::slug('Bruno Silva') and save it in the model as 'slug'. This will convert the name to .../profile/bruno-silva

29 Sep
4 years ago

Raymond started a new conversation A Good Package/Workbench Structure Laravel 5

Hi,

I stuble upon something, wanted to make some packages available for Laravel 5 and PSR-4, but i didn't had a clue, how to accomplish that. But now i've found something and want to ask you all I this is a good structure.

My example (folder structure) looks like this:

- *Users*
- - *Events*
- - UserRegistered.php
- - *Http*
- - - *Controllers*
- - - RegistrationsController.php
- - - *Request*
- - - RegisterUserRequest.php
- - *Providers*
- - RouteServiceProvider.php
- - UsersServiceProvider.php
- - *Repositories*
- - UserEloquentRepository.php
- - UserRepository.php
- composer.json
- RegisterNewUserCommand.php
- RegisterNewUserCommandHandler.php
- Role.php
- User.php

Also i wanna ask @JeffreyWay and/or @TaylorOtwell if this is a good way to do it?

Raymond left a reply on Mobile Menu?

yes i seen it to thx @JeffreyWay

15 Sep
4 years ago

Raymond left a reply on 5.0 Validation For Unique Update Using FormRequest

I asked this question 2 :-) the anser is: $this->id

Raymond started a new conversation Wsedom To Use Php Feature ClassName::class

@JeffreyWay showed us ClassName::class in one of the series, I also noticed that this can also be done for:

protected $presenter = UserPresenter::class;
// Or
public function articles()
    {
        return $this->hasMany(Article::class);
    }
// Or
$this->app->bind( ArticleRepository::class,  ArticleEloquentRepository::class );

But is it wise to use like how i do it?

14 Sep
4 years ago

Raymond started a new conversation How To Validate A Slug Unique In Laravel 5?

I have the following controller: http://laravel.io/bin/ByJo0 And the request: http://laravel.io/bin/23KkE And the model: http://laravel.io/bin/LNqm0

Problem is and what i am trying to achieve is to make the slug before running the validation, without changing the formRequest made by Laravel,

Laracasts is really great, but what i am always missing, are these particular things like how to update a slug, or how to update an unique field.

13 Sep
4 years ago

Raymond left a reply on Laravel 5 Validation Request, How To Handle Validation On Update?

That is finally the thing that i gonna remember :-) thanks @enginebit, after 2-3 years of coding i always stumbled upon this particular thing. And btw, i use the get('id') that gives me more flexibility on my routes :-)

Raymond left a reply on Laravel 5 Validation Request, How To Handle Validation On Update?

@nsnihalsahu.code thanks, but that part i am already, read it again :-). Problem is how to set the ID in the rule.

i could do one of following things:

public function rules(Request $request)
 {
    return [
   'email' => 'required|unique:users,id,'.$request->segment(2),
   // Or i could do...
   'email' => 'required|unique:users,id,'.$request->get('id'),
   ...
    ];
 }

Raymond started a new conversation Laravel 5 Validation Request, How To Handle Validation On Update?

First of all I love the way that validation is going through, can now easily use

    public function authorize(Authenticator $auth)
    {
        return $auth->user()->hasRole('administrator');
    }

That's not the problem, I bump always into another problem... that is when you update an record, how to do things with the rules? If I need to update an email, I need the following string: 'email' => 'unique:users,email_address,10'. In this case it should look like:

public function rules()
    {
        return [
            'email' => 'required|unique:users,email,?????',
            'tags' => 'required'
        ];
    }

Who can help me with this issue?

Raymond left a reply on Laravel Socialite Installation Error

@nsnihalsahu.code

What you can do is the following:

"require": {
  "laravel/framework": "~5.0",
  "illuminate/html": "~5.0",
  "laravel/socialite": "2.0.*@dev"
 },

way/generators isn't ready yet, i did a pull request, I think @jeffrey_way wil update this soon.

Raymond left a reply on Slowly All Packages Are Bumped To 5.0.*, What Package Are You Missing Right Now?

I know, but if you want do it fast you'll get stuck. I love the use of 'composer install package/name'

Raymond left a reply on Laravel Socialite Installation Error

You need to use 2.0.*@dev

12 Sep
4 years ago

Raymond left a reply on Command Handlers, Using Two Repositories

Hmm, you could also do the following (this is working for me)

class WorkRepository {
    public function createJob($userId, $workData, $markerData)
    {
        $user = User::find($userId);
        $work = $user->work()->create($workData);
        $work->create($markerData);
        return $work;
}

Raymond left a reply on [5.0] User Activation

@keevitaja I use is_active (bool), so i could do:

if(Auth::user()->isActive())
    return intended('/'); // change the redirect() :-)
else
   return redirect('/not_active')

Raymond left a reply on Filtering/Loading Pins On A Google Map

And in eloquent i believe you could do something like:

class User extends Model {
    public function search($lat, $lon, $distance) {
        return $this->select(DB::raw('CALL users_from_point(?, ?, ?)',[$lat, $lon, $distance]))->get();
    }
}

Raymond left a reply on Filtering/Loading Pins On A Google Map

Hi, first off all if I was you, i should cap it to a maximum of 100, because it could be possible if you zoom out you'll hit the 100,000 if that's done, you could choose to filter it by radius, if you are using mysql i strongly suggest to use the stored procedure example:

DROP PROCEDURE IF EXISTS users_from_point;
DELIMITER $$
CREATE PROCEDURE users_from_point(IN lat double,lon double, maxdist int)
BEGIN
SELECT name, address, city, state, zip, country, features image
# calculate the distance from the given longitude, latitude
    sqrt( 
        (POW(a.latitude - lat, 2)* 68.1 * 68.1) + 
        (POW(a.longitude - lon, 2) * 53.1 * 53.1) 
     ) AS distance
FROM foobar AS a 
WHERE 1=1
HAVING distance < maxdist
ORDER BY distance ASC;
# to use LIMIT you need to use a prepared statement to avoid errors
END
$$
DELIMITER ;

once you've done this you could do something like

CALL users_from_point('52.3402', '4.8589', '10');

Raymond started a new conversation Whoops Something Went Wrong...

@JeffreyWay, there is a 'Whoops something went wrong' on https://laracasts.com/discuss?filter_by=contributed_to

Raymond started a new conversation Slowly All Packages Are Bumped To 5.0.*, What Package Are You Missing Right Now?

Hey i noticed right now that the illuminate packages are updated right now, it breaks little features like way/generators(well.. little...) :-) Jeff i hope you gonna see my pull request soon :-)

I am missing:

  • way/generators ;-)
  • laravel/socialite

Raymond left a reply on Mobile Menu?

Haha, me to, but nowadays you can't live without :-)

10 Sep
4 years ago

Raymond started a new conversation Mobile Menu?

I am missing some links in the mobile section of this site, often i am checking 'whats new', but on my iphone the link 'whats new' is gone...