bestmomo

bestmomo

Member Since 4 Years Ago

Toulouse, France

Experience Points 359,620
Experience Level 50

0 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 20
Lessons
Completed
Best Reply Awards 408
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.

09 Mar
1 month ago
08 Mar
1 month ago

bestmomo left a reply on Why Should I Use 'storage:link"?

Your storage is not always placed locally but for example on S3. In this case you need a symbolic link.

bestmomo left a reply on Selecting Row Number 2

When you say row, what is the context ?

bestmomo left a reply on What Css Framework Should I Use?

It's really a matter of personal taste. I sometimes use Bootstrap and sometimes Materialize according to my mood. In any case, you still have to adapt the framework according to the desired visual effect. Depending on the type of project it will guide the choice.

There are good comparatives on the subject like this one.

07 Mar
1 month ago

bestmomo left a reply on Laravel Collectivity Is Not Work 5.8 Version ? The Site Is Off . So How To Do Use It Or Project Develop Without Laravel Collectivity ? Response Skilled Person . About Laravel ..

@towhid For example I have this view for a form :

@extends('layouts.form')

@section('card')

    @component('components.card')

        @slot('title')
            @lang('Ajouter un album')
        @endslot

        <form method="POST" action="{{ route('album.store') }}">
            @csrf

            @include('partials.form-group', [
                'title' => __('Nom'),
                'type' => 'text',
                'name' => 'name',
                'required' => true,
                ])

            @component('components.button')
                @lang('Envoyer')
            @endcomponent

        </form>

    @endcomponent

@endsection

The syntax is clean.

I have a component card, another for the button and a partial pour the input. Here is the partial :

<div class="form-group">
    <label for="{{ $name }}">{{ $title }}</label>
    <input id="{{ $name }}" type="{{ $type }}" class="form-control{{ $errors->has($name) ? ' is-invalid' : '' }}"
           name="{{ $name }}" value="{{ old($name, isset($value) ? $value : '') }}" {{ $required ? 'required' : ''}}>

    @if ($errors->has($name))
        <div class="invalid-feedback">
            {{ $errors->first($name) }}
        </div>
    @endif
</div>

And for eaxample the card component :

<div class="card text-white bg-dark mb-3">
    <h4 class="card-header">
        {{ $title }}
    </h4>
    <div class="card-body">
        {{ $slot }}
    </div>
</div>

bestmomo left a reply on How To Work My Created Sedder Class With My Factory Class

You must call your class :

class DatabaseSeeder extends Seeder

...


public function run()
{
        $this->call(ProductSeeder::class);
}

bestmomo left a reply on Base Url

public_html is your server directory, helper will work if your domain points well on this folder.

bestmomo left a reply on ReferenceError: $ Is Not Defined

So it's the issue, inverse it.

bestmomo left a reply on How To Set Condition Into Button

Yes it's much cleaner with @if and @else.

bestmomo left a reply on How To Work My Created Sedder Class With My Factory Class

Which code did you put in DatabaseSeeder.php ?

bestmomo left a reply on Select Option Not Working

Not sure it's the problem but using clone() has the side-effect of producing elements with duplicate id attributes.

bestmomo left a reply on ReferenceError: $ Is Not Defined

Is your Javascript code included before jQuery loading ?

bestmomo left a reply on Seed Error : Array To String Conversion ...

I think $faker->words generate an array.

bestmomo left a reply on Base Url

Have a look at all helpers ;)

02 Mar
1 month ago

bestmomo left a reply on Can I Show A Card Only For A Specific User Type?

What do you mean with card ?

bestmomo left a reply on Which Version Of Laravel For A Fresh New Project?

In your place I will use version 5.8 without hesitation

bestmomo left a reply on Upgrade To 5.8 :: Class Blade.compiler Does Not Exist

For upgrade the best way is to use a fresh new install and copy files. It may seem longer but finally we save time.

01 Mar
1 month ago

bestmomo left a reply on Laravel Routes

For information I added Controllers command with V0.3

26 Feb
1 month ago

bestmomo left a reply on Helper Issue

With a good hoster you can set the root directory for any sub-domain.

bestmomo left a reply on Migration Do Not Work In Laravel 5.8

Just checked new version 5.8, migrations work nice for me...

bestmomo left a reply on Laravel Routes

For information I added List command with V0.2

24 Feb
2 months ago

bestmomo left a reply on Overwriting Package Code

hi,

I see in config file that you can choose your generator :

/*
|--------------------------------------------------------------------------
| Captcha generator.
|--------------------------------------------------------------------------
| Must implement GeneratorInterface.
|
*/
'generator' => \Igoshev\Captcha\Captcha\Generator\GeneratorWaves::class,

So you can create your own generator et change config to select it.

21 Feb
2 months ago

bestmomo left a reply on Laravel Eloquent Relationship

If you get Trying to get property 'blogpost' of non-object means that you dont get the user, so route binding is not working. How is your route ?

bestmomo left a reply on Setting Vue Data With Props Object Key, Value

Are you sure the data is passed by parent composer when the child is mounted ?

bestmomo left a reply on Setting Vue Data With Props Object Key, Value

You should get all values with your syntax...

To select a pair key/value you only need an index and use Object.entries to get the element.

20 Feb
2 months ago

bestmomo left a reply on Cleaner Controllers

It might also be interesting to do route model binding to avoid :

$instructor = \App\Instructor::find($id);
18 Feb
2 months ago

bestmomo left a reply on Laravel Routes

Thanks both for answers.

@bobbybouwmann

I am not very good with UX ;)

  • I planned to develop the tool with the generation of declared controllers.
  • For route:list as I use Javascript to generate I can't get the PHP intendance, I'll see that...
  • Extra templates would be nice ;)

bestmomo left a reply on How To Do This Better

Or simply :

public function imageUrl($region, $bucket, $directory, $file)
{
    return "http://s3.$region.amazonaws.com/$bucket/$directory/$file";
}

bestmomo started a new conversation Laravel Routes

Hello the forum !

I made a small tool to facilitate the writing of the route file for Laravel. It's still in alpha version.

Hope it'll help...

06 Dec
4 months ago

bestmomo left a reply on Administration

Thank you fort interesting answers but my initial question is on code organisation :)

bestmomo left a reply on Auth::user(); Authentication In Core Php

I made something with Laravel 5.2 to use it with code PHP :

require getcwd() . '/../../../../bootstrap/autoload.php'; // Adapt to your path
$app = require_once getcwd() . '/../../../../bootstrap/app.php';
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
$response = $kernel->handle(
  $request = Illuminate\Http\Request::capture()
);
$id = $app['encrypter']->decrypt($_COOKIE[$app['config']['session.cookie']]);
$app['session']->driver()->setId($id);
$app['session']->driver()->start();

Then you have Laravel in $app and use $app['auth'] I dont know if it still works with 5.7 version.

bestmomo left a reply on UPGRADE TO LARAVEL 5.7 FROM 5.4

For a clean upgrade install Laravel 5.7 and copy all files. Seems longer but you'll spend less time with bugs tracking ;)

05 Dec
4 months ago

bestmomo left a reply on Using Auth::user(); In Core Php

I made something with Laravel 5.2 to get Laravel app from core PHP :

require getcwd() . '/../../../../bootstrap/autoload.php';
$app = require_once getcwd() . '/../../../../bootstrap/app.php';
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
$response = $kernel->handle(
  $request = Illuminate\Http\Request::capture()
);
$id = $app['encrypter']->decrypt($_COOKIE[$app['config']['session.cookie']]);
$app['session']->driver()->setId($id);
$app['session']->driver()->start();

Dont know if it works with recent Laravel version but it's a way. You can use $app['auth'] for example.

bestmomo left a reply on Is This Good Approach To Have Own Service Provider?

There is no rule, make as you feel. Code organisation is a story of personal covenant unless the development is done by several people, so they have to agree...

bestmomo started a new conversation Administration

I have explored the available packages to facilitate the construction of an administration: Voyager, LaraAdmin, Backpack, Boilerplate (not Nova which is a paid solution and I code only for fun) and others ... But I can not satisfy myself and I ended almost systematically to create something in my own way ...

But whether it is a package or the personal code we end up with a transplant not necessarily well digested. I like the isolation of treatments because it makes things clearer. At the code level it's easy but when we reason more globally it becomes problematic.

So I thought after all why not completely distinguish frontend and backend with two separate installations of Laravel (or other)? The advantage of the package-specific separation is preserved without the inconvenience of code complexity and mandatory entanglements. It is also easy to reuse the code by enriching it with each project by providing optional features for example.

I think that I will adopt this approach for my next project but I would like to have your opinion on the subject ...

29 Sep
6 months ago

bestmomo left a reply on Array Combine Totals

Not sure to understand your question but array_merge is always working.

bestmomo left a reply on How To Pass Additional Parameters To Resource Class?

@alihoushyaripour

I made a test, you can add an attribute to your model and after send it to your resource. It works.

I made a simple UserResource and :

$user = User::find(1);
$user->test = 'ok';
$resource = new UserResource($user);
dd($resource);

I get that for the resource :

#attributes: array:12 [▼
      "id" => 1
      "name" => "Adam"

      ...

      "test" => "ok"
    ]

bestmomo left a reply on Is Bootstrap-multiselect Plugin Is Compatible With Bootstrap 4.1 ?

Maybe you can use this PR to make it work with Bootstrap 4.

bestmomo left a reply on Want To Access A Particular Array Element.

Could you show dd($data['Documents']) ?

bestmomo left a reply on Database Design / One To Many

  1. I would create a One To One relation between Image and Product (Image has one Product with foreign key on Product).

  2. I dont really understand, you load relation only if you use productImages().

bestmomo left a reply on SetLocale

Usually setLocale is set in a middleware.

bestmomo left a reply on How To Pass Additional Parameters To Resource Class?

Why not just add this to gift ?

$gift->from = 'PlaceController';

bestmomo left a reply on Route For Different User Types

Just send 2 parameters and update your middleware code. Look at documentation.

27 Sep
6 months ago

bestmomo left a reply on Append To And Modify Users Collection In Controller Before Pass It To View

Hello,

With your solution you send 3 queries to database, not really optimized. Maybe this kind of code is better :

$all = collect(User::all()->toArray());

$users = $all->where('competition1', 'yes')->map(function($item, $key) {
    $item['location'] = 'foo';
    return $item;
})->concat($all->where('competition2', 'yes')->map(function($item, $key) {
    $item['location'] = 'bar';
    return $item;
})->concat($all->where('competition3', 'yes')->map(function($item, $key) {
    $item['location'] = 'some';
    return $item;
})));

dd($users);