Sti3bas

Member Since 1 Year Ago

Experience Points 125,970
Experience Level 26

4,030 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 1005
Lessons
Completed
Best Reply Awards 43
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.

15 Sep
20 hours ago

Sti3bas left a reply on Use Auth Scaffolding As API

Consider to use Lumen instead: https://lumen.laravel.com

Sti3bas left a reply on Queue And Datas On The Fly

You're probably using SerializesModels trait in your job class.

Because of the SerializesModels trait that the job is using, Eloquent models will be gracefully serialized and unserialized when the job is processing. If your queued job accepts an Eloquent model in its constructor, only the identifier for the model will be serialized onto the queue. When the job is actually handled, the queue system will automatically re-retrieve the full model instance from the database. It's all totally transparent to your application and prevents issues that can arise from serializing full Eloquent model instances.

https://laravel.com/docs/6.0/queues#class-structure

14 Sep
1 day ago

Sti3bas left a reply on Laravel 6 Which Is The Best Alternate Method Of Laravel Pluck??

@kaushal what? where do you found that it's deprecated?

Sti3bas left a reply on Polymorphic Approach For Routes?

Config:

'morph_aliases' => [
    'tweet' => 'App\Tweet',
    'video' => 'App\Video',
    // ...
]

Route:

Route::post('/favorite/{type}/{id}', '[email protected]');

Controller:

public function store($type, $id) {
    $types = config('app.morph_aliases');
    
    // ensure type exists
    if(!in_array($type, array_keys($types))) {
        abort(404);
    }
    
    // ensure item exists
    $types[$type]::findOrFail($id);
    
    Favorite::create([
        'favoriteable_id' => $id,
        'favoriteable_type' => $type,
        // ...
    ]);
}

AppServiceProvider:

use Illuminate\Database\Eloquent\Relations\Relation;

public function boot()
{
    Relation::morphMap(config('app.morph_aliases));
}

Sti3bas left a reply on How To Receive Data From User With Request With Less Code In Laravel

View:

<input type="text" name="item[]" value="1">
<input type="text" name="item[]" value="2">
<input type="text" name="item[]" value="3">

Controller:

$request->get('item'); // returns [0 => "1", 1 => "2", 2 => "3"]

Sti3bas left a reply on Vue Not Passing Data Forward

@mikekelly he don't need 2-way binding because it's hidden field.

@hjortur17 that's because your form is not re-rendered yet when you submitting it.

Try this:

this.$nextTick(() => {
      this.$refs.netgiroForm.submit();
});

Sti3bas left a reply on Can Telescope Use Non-MySQL Databases Without Any Negative Side Effects?

@mia305brkl no, otherwise database driver would not be configurable.

Laravel currently supports 4 databases: https://laravel.com/docs/6.x/database

Sti3bas left a reply on Retrieve A Feedback After Connection Of An User

->when($user->hasRole('admin') !== true, function (Builder $query) use ($user) {
        \Auth::user()->load('feedbacks');
        $feedbacksForThisUser = \Auth::user()->feedbacks;
    })

should be

->when($user->hasRole('admin') !== true, function (Builder $query) use ($user) {
    return $query->where('user_id', $user->id);
})
13 Sep
2 days ago

Sti3bas left a reply on LaravelCollection/Html Form Select Difference

but when I try and add the partial

Where are you adding it?

Sti3bas left a reply on WebPush Notifications In Background?

@jorgealberto you don't need websockets to send push notifications.

You can use WebPush notifications channel on the backend: http://laravel-notification-channels.com/webpush/

Here is the service worker code: https://github.com/cretueusebiu/laravel-web-push-demo/blob/master/public/sw.js

12 Sep
3 days ago

Sti3bas left a reply on Can I Deploy From Forge On Multiple D.O. Accounts ?

@nidal yes, you can. Growth ($19/month) plan includes unlimited servers and sites.

Sti3bas left a reply on Customising Forgotten Password

@johnnyw2001 this is the method responsible for getting user from the database: https://github.com/illuminate/auth/blob/master/EloquentUserProvider.php#L106

You should probably create your own user provider by extending this one and adding a whereNotNull('password') clause to the query.

https://laravel.com/docs/5.8/authentication#adding-custom-user-providers

Sti3bas left a reply on Redirect On Success Paypal Transaction

@chron probably. I've never used Paypal API myself, try to check their docs.

Sti3bas left a reply on Should I Make Special Migrations Just For Tests?

I use the same migrations, but I have few migrations which acts differently based on database driver (SQLite and MySQL).

Recently, I've discovered a bug in production which was related to incompatibility between SQLite and MySQL, so I've decided to run my full test suite on MySQL before deploying to production. And surprisingly running the whole test suite on MySQL is faster than SQLite, because my project has ~40 migrations.

https://alexvanderbist.com/posts/2019/how-migrations-might-be-slowing-down-your-laravel-tests

Sti3bas left a reply on Redirect On Success Paypal Transaction

@chron because you have to use arrow function. Change actions.order.capture().then(function(details) { to actions.order.capture().then(details => {.

Sti3bas left a reply on In Envoy Script Console Command Raise Error

@petrogromovo seems like you're not in the root directory. Do you tried to cd into the directory first?

cd {{ $release_number_dir }}

Sti3bas left a reply on Laravel Testing

This is the best course you can find: https://testdrivenlaravel.com

Sti3bas left a reply on Redirect On Success Paypal Transaction

onApprove: (data, actions) => {
    return actions.order.capture().then(function(details) {
        axios.post('/test', {
            headers: {
                'content-type' : 'application/json'
            }
        })
        .then(res => {
            this.totalPrice = res.data;
            // here?
        window.location.replace("your_link");
        })
        .catch(err => console.log(err))
    });
}
11 Sep
4 days ago

Sti3bas left a reply on Fetch API And Laravel

@russellwwest are you setting Content-Type: application/json header?

Sti3bas left a reply on Web Routing - ERR_TOO_MANY_REDIRECTS

@raindeer maybe because of two / routes?

Route::get('/', function () {
    return view('auth/login');
});

is not needed.

Sti3bas left a reply on Synchronous Execution Working Fine But Problems With Asynchronous JQuey Ajax

@axelbol pass user roles from the controller, then loop through checkboxes and update its checked prop:

$.each($("input[name='roles[]']"), function() {
    $(this).prop("checked", (data.roles.indexOf($(this).val()) > -1));
});

Something like that.

Sti3bas left a reply on The Process Class Relies On Proc_open, Which Is Not Available On Your PHP Installation.

@remigis first of all, instead of using mail function you can use smtp mail driver. Don't forget to fill the settings in the .env file. This will solve your original issue.

The second issue seems to be related to redirect()->back(). Do you tried to redirect to the exact route instead of using back()?

Sti3bas left a reply on Password Reset Issue

@mattb if you're using default view, you should also pass token and email.

public function showResetForm(Request $request, $token = null)
{
    return view('auth.passwords.reset', [
        'categoryMenu' => Categories::all(),
        'token' => $token,
        'email' => $request->email,
    ]);
}

Sti3bas left a reply on The Process Class Relies On Proc_open, Which Is Not Available On Your PHP Installation.

@remigis are you on shared hosting? Seems like your hosting doesn't support proc_open function.

Sti3bas left a reply on Pass Data To Mounted Hook

You should use arrow function so that you could access vue instance. Change createOrder: function(data, actions) { to createOrder: (data, actions) => { and it should work.

More about the scopes: https://javascriptplayground.com/javascript-variable-scope-this/

Sti3bas left a reply on Using Foundation 6 On Laravel 6

@oki what error you get?

Sti3bas left a reply on Multi-tenancy Using Laravel App

@aqeel94321 what exact problems you have?

Sti3bas left a reply on Select2: How To Convert Array To Collection?

@splendidkeen update your view with <option value="{{$user->id}}">{{$user->first_name}}</option>. You need to pass id only, not the whole user object.

Sti3bas left a reply on Binding Interface To Service Container Not Resolving In Constructor

@bwrigley it's enough. It will inject binded class automatically whenever you resolve a class which has that interface as a dependency. For example:

app(ProfileViewReport::class); // GoogleAnalyticsClient will be automatically injected to the constructor

class ExampleController extends Controller
{
    public function __construct(AnalyticsClient $analyticsClient)
    {
        // $analyticsClient will be an instance of GoogleAnalyticsClient
    }

    public function index(AnalyticsClient $analyticsClient) {
        // $analyticsClient will be an instance of GoogleAnalyticsClient
    }
}

But if you instantiate a class yourself with new keyword you have to pass dependencies yourself as usual.

new ProfileViewReport; - will throw Too few arguments to function exception.

Is it more clear now?

Sti3bas left a reply on Multi-tenancy Using Laravel App

@aqeel94321 I don't have any demo project. Just follow the docs and you will be able to setup it yourself.

Sti3bas left a reply on Multi-tenancy Using Laravel App

I've used hyn/multi-tenancy package in the past (and even made few contributions) and it worked really great.

Here is the boilerplate project https://github.com/peartreedigital/boilerplate

It's a bit old, but you should get the point by reading the code.

And yeah, it supports multiple databases.

Sti3bas left a reply on Many To Many Relationship

@atfinho please mark it as answered

Sti3bas left a reply on Select2: How To Convert Array To Collection?

<option value="{{$user->id}}">{{$user->first_name}}</option>
User::whereIn('id', $request->input('users'))->get()->map(function($user) {
    // You can now access User model
    $user->id;
});

Sti3bas left a reply on Multi-tenancy Using Laravel App

@aqeel94321 what are the reasons for not using a package?

Sti3bas left a reply on Many To Many Relationship

https://laravel.com/docs/6.0/eloquent-relationships#updating-many-to-many-relationships

When attaching a relationship to a model, you may also pass an array of additional data to be inserted into the intermediate table:

$user->roles()->attach($roleId, ['expires' => $expires]);

Sti3bas left a reply on Moving User Id To Uuid

@abdallahsabri it should work the same way as with incremental ids.

Sti3bas left a reply on Binding Interface To Service Container Not Resolving In Constructor

@bwrigley yeah, you can do that in any class which is resolved from the container. Controllers, event listeners, middleware etc.

https://laravel.com/docs/6.0/container#automatic-injection

10 Sep
5 days ago

Sti3bas left a reply on Binding Interface To Service Container Not Resolving In Constructor

@bwrigley sorry, but I don't understand your question. Can you give some more details?

Sti3bas left a reply on Binding Interface To Service Container Not Resolving In Constructor

@bwrigley no, you should resolve it from the container: app(ProfileViewReport::class). Otherwise you should pass it as a param: new \App\Reports\ProfileViewReport(app(AnalyticsClient::class)).