RomainLanz

RomainLanz

Romont, CH

Member Since 4 Years Ago

Experience Points 64,895
Experience
Level
Lessons Completed 452
Lessons
Completed
Best Reply Awards 42
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.

27 Jan
1 year ago

RomainLanz left a reply on Laravel Mix ERROR ( LARAVEL 5.4.5)

Hey !

Are you running on Windows ?

If yes there's some problem with fs-event. You must use the flag --no-optional.

16 Nov
1 year ago

RomainLanz left a reply on Laracasts Refresh

I'm loving the new design!

One notice, the login-modal is in the HTML even if you are already logged in. This made LastPass buggy because he tries to log you in each time (if you have the auto-loggin enabled).

29 Sep
2 years ago

RomainLanz left a reply on AdonisJs 3.0 Is Out - Laravel For Node.js

But why would you need to create your own wrapper if there's already an official PHP package to call gRPC?

--> https://github.com/grpc/grpc/tree/master/src/php

RomainLanz left a reply on AdonisJs 3.0 Is Out - Laravel For Node.js

@leonardharley gRPC has a PHP version if you look at the repository: https://github.com/grpc/grpc

21 Sep
2 years ago

RomainLanz left a reply on .gitignore What Should Be Ignored?

@kreierson Your composer.lock file already manage to keep the same version of packages you use in production.

RomainLanz left a reply on AdonisJs 3.0 Is Out - Laravel For Node.js

Hey @leonardharley !

Which type of information do you need? I'll be happy to answer to some of your questions.

We're thinking along the lines of Vue on the front-end with Adonis on the backend. Does this make sense? Why this would make sense? Front-end and back-end are different things, you can use whatever frontend framework with whatever backend technologies/frameworks.

12 Sep
2 years ago

RomainLanz started a new conversation Oivva/boxy: The Most Hackable Theme For Sublime Text 3

Hey everyone !

I just found an awesome theme for Sublime Text 3 that I think you should give a look.

--> https://github.com/oivva/st-boxy

09 Sep
2 years ago

RomainLanz left a reply on How To Ignore Local Composer.lock On FORGE Server And Pull Newest From GitHub?

Hey @mesqueeb !

You should connect to your server with ssh and reset the stage.

git status # You should see your composer.lock file
git checkout -- composer.lock

Then you can relaunch your deployment. Ensure that you aren't running composer update in your deployment script.

07 Sep
2 years ago

RomainLanz left a reply on Caching Eloquent Models Since Laravel 5

No.

Look at the Cache Documentation chapter Retrieve & Store.

RomainLanz left a reply on Where('field', Null) Is Not Working

Hey @rene !

You should check if the value of $request->get('foobar') is null or not when writing your query.

$query = Foobar::where('user_id', 1)

if (!is_null($request->get('foobar'))) {
  $query->where('second_id', $request->get('foobar'));
}

$query->first();

RomainLanz left a reply on Caching Eloquent Models Since Laravel 5

Hey @BartHuis !

Maybe you should give a try to the package made by @Omranic : The art of using Repositories in Laravel 5.3

RomainLanz left a reply on Custom Facace Throws "Class 'App\Providers\App' Not Found"

Hey @Rocky !

The issue is in App\Providers\PlayOnServiceProvider.php.

You are using App without importing it!

<?php

namespace App\Providers;

use App;
use Illuminate\Support\ServiceProvider;

class PlayOnServiceProvider extends ServiceProvider
{
    // ...
}

RomainLanz left a reply on What Is The Best Way To Implement Social Auth And Payments?

Hey @Alzaabi98 !

For Social Login you should take a look to Socialite.

For payments there's Cashier (for Stripe) or Cashier Braintree for Braintree.

RomainLanz left a reply on Get Child Id To Array

Hey @wipflash !

Seems to be a great idea to use mapand flatten! (Thanks to @adamwathan)

// Assuming that $childs is your array
$childIds = collect($childs)->map(function ($item) {
    return collect($item)->flatten();
});

Code Example: http://pastebin.com/kBaWqrUM

06 Sep
2 years ago

RomainLanz left a reply on Storing Users

@nate.a.johnson According to the category of the forum he asks for a code review.

I cannot do it right know but I'll be happy to do it tomorrow if no-one else has done it before ! :)

RomainLanz left a reply on Two Models With Similar Name.

Hey @Archduke !

So you have a table named CreateOffers and a model name CreateOffer?

The convention of Laravel is to snake case your model and pluralize it to get the table name, if you have something different you can override the default table name by setting the table attribute on your model.

<?php

class CreateOffer extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'CreateOffers';
}

Related documentation

RomainLanz left a reply on Artisan Output Colours (low Contrast = Unreadable)

Hey @derekmcwhinnie !

This is not the fault of Laravel.

You may change the colorsheme of your terminal (or the contrast in the configuration) to get something that you like.

RomainLanz left a reply on View Depending On Middleware

Hey @JhumanJ and welcome to Laracasts!

Your code looks perfectly fine. Did you get any error or it is just always redirecting to one view?

RomainLanz left a reply on Create Route To Controller That Is In It's Own Folder

@mstnorris You can only use the / and it will work perfectly.

php artisan make:controller Admin/PostController

RomainLanz left a reply on Create Route To Controller That Is In It's Own Folder

You should namespace it!

Route::get('/admin/posts', 'Admin/[email protected]');

and inside your PostController

<?php

namespace App/Http/Controllers/Admin;

// ...

RomainLanz left a reply on Upgrade To Laravel 5.3 Killed Localhost

I tried changing the Laravel index.php file to simply echo a "p" element to test, but still the same problem.

It seems to be an issue with Apache. You should check the log of it.

RomainLanz left a reply on Database Engines With Laravel

You can use the Eloquent ORM to have fluid "sql queries" with both of them.

RomainLanz left a reply on Database Engines With Laravel

but is it the best for my project ?

As we said, it all depends on your application specification.

  • MongoDB is a document-oriented (NoSQL) database engine.
  • MySQL is a relational database engine.
  • PostegreSQL is a object-relational database engine.

RomainLanz left a reply on Database Engines With Laravel

Its all depending on your application. Personally I recommend you to use PostgreSQL.

Here's a good podcast about it Full Stack Radio 40: Edd Mann - You Should Switch to Postgres

RomainLanz left a reply on Method Chaining On Model

Hey @eddy1992 !

The result you get is an instance of your Eloquent model. You need to add a public method named checkIfPhoneExists() into your Customer model.

RomainLanz left a reply on Relation After A Value

Hey @crazydan !

You should definitively go for Query Scope.

RomainLanz left a reply on Simple Eloquent Relationship

That's because you are showing the Country object of the user.

If you want to display the name of the country you should do get the attribute of Country object.

{{ $user->country->country }} 

RomainLanz left a reply on Simple Eloquent Relationship

Hey @jim1506 !

Correct me if I didn't correctly understand your question but you want to get all the users with country information on it?

If yes, it's the perfect job to use Eager Loading.

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

Pro Tip: Your user relation on Country model should be called users because it's a HasMany.

RomainLanz left a reply on [Laravel 5.3.6] How To Modify "make:auth" Route To "/home" Behavior?

Hey @Laraveldeep !

The redirection is in the Middleware RedirectIfAuthenticated at the line 21.

RomainLanz left a reply on What Development Languages Laracasts.com Is Developed

Hey @shafiqkr !

Laracasts is developed with Laravel and VueJs. The UI has been homemade by Jeffrey Way with Stylus and LostGrid (He has a series about it https://laracasts.com/series/modern-css-workflow).

27 Jun
2 years ago

RomainLanz started a new conversation AdonisJs 3.0 Is Out - Laravel For Node.js

Hey everyone!

I want to share with you a great new. AdonisJs 3.0 is out !

AdonisJs is a true MVC Framework for Node.js. It encapsulate all the boring parts of Web programming and offers you a nice & clean API to work with.

https://adonisjs.svbtle.com/adonisjs-30-release

Website: http://adonisjs.com/

04 May
2 years ago

RomainLanz left a reply on Laravel Echo

Oh, it wasn't a teaser so.... :(

Thanks!

RomainLanz started a new conversation Laravel Echo

Taylor tease us about a new Laravel Thing yesterday !

https://twitter.com/taylorotwell/status/727357237476257793

What do you it would be?

04 Mar
2 years ago

RomainLanz left a reply on Spark Will Not Be Free

Here's the Reddit thread: https://www.reddit.com/r/laravel/comments/48tzkg/laravel_spark_will_not_be_free_unjustifiable_to/

@bashy Some people have fork the alpha. You can find the link in the reddit thread.

11 Jan
2 years ago

RomainLanz started a new conversation How To Get Auth Model With L5.2

Hey,

I have a little package to implements easily Polymorphic Nested Comments in Laravel.

In the model Comment I have a relation who belongs to the User model.

/**
 * Get the user that creates the comment.
 *
 * @return Illuminate\Database\Eloquent\Relations\BelongsTo
 */
public function user()
{
    return $this->belongsTo(config()->get('auth.model'));
}

In Laravel 5.1, the model can easily be retrieved via the configuration file. But with 5.2, this section has change and I have no idea how to properly get it.

Does anyone have an idea?

PR are welcome. https://github.com/Slynova-Org/laravel-commentable/issues/3

07 Dec
2 years ago

RomainLanz left a reply on Where Should I Put This?

which gets a user's latest review for a venue.

It speak by itself. You should place this method in the UserRepository.
BTW, it doesn't really matter. Do what you think is the most logic to you.

RomainLanz left a reply on Color Theme Jeffrey Uses In Vue Training Series

He uses Sublime Text with the Material Theme and the Facebook Colorscheme.

He mades a series about his setup in Sublime.

02 Dec
2 years ago

RomainLanz left a reply on Route Issue

What's the content of your stores() method?

RomainLanz left a reply on Laravel For The NodeJS World

Have you done any work with it yet I discovered it today, so no.

I will try it before the end of the week and give some feedbacks here. There's some ScreenCasts available.

Laravel equivalent syntax that AdonisJS offers in comparison to ExpressJS Just for the ES2015 feature/syntax it's worth to switch in my opinion.

RomainLanz started a new conversation Laravel For The NodeJS World

Hey everyone!

I have just discovered the framework AdonisJS.

What is it awesome with it ? It's a Laravel port to the NodeJS world!

Hope that you will enjoy to test it and develop with it.

30 Nov
2 years ago

RomainLanz left a reply on How To Encrypt My Code In Php In General And In Laravel In Specific

ASP.NET does not encrypt the code. It's just a compiled language.

PHP is a dynamic language, so you can't compiled it to a binary.

28 Nov
2 years ago

RomainLanz left a reply on How To Stress Test My Laravel App?

There is a thread Load Testing Tool.

Does it help?

25 Nov
2 years ago

RomainLanz left a reply on Building A Robust Decorator

I think you are speaking about Single Table Inheritance ?

RomainLanz left a reply on Update Get Id

If you want to get the ID of the eddited row you can do it like this.

$post = Post::update($request->all());

Or, if you want the latest edited record you can do:

$post = Post::orderBy('updated_at')->first();
22 Nov
2 years ago

RomainLanz left a reply on Permission Denied

The error is pretty clear...

You don't have the permission to delete the file. Also, note that there's nothing returned by $book->book_path.

20 Nov
2 years ago

RomainLanz left a reply on Some Of My Laravel Authorization Abilities Work And Some Don't.

Also

public function isAdmin()
{
    return $this->hasRole('admin');
}

RomainLanz left a reply on Some Of My Laravel Authorization Abilities Work And Some Don't.

You can simplify your method by doing

public function is_Admin(User $user)
{
    return $user->isAdmin();
}

Can we see the isAdmin() method?

RomainLanz left a reply on Front End Frameworks

@bestmomo

I've seen Toasts but there are called with Javascript and it's not simple to add an alert on load.

Yes it is.

I think that you haven't seen this Elegant Flash Messaging in Build "ProjectFlyer" With Me episode?

He use SweetAlert that is called with JavaScript.

What you should do to call an alert with JavaScript is simple.

{-- alert.blade.php --}
@if (session()->has('flash_message'))
    <script>
        // Call your alert here
    </script>
@endif