neilstee

Member Since 2 Years Ago

Manila

Experience Points
34,440
Total
Experience

560 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
232
Lessons
Completed
Best Reply Awards
12
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 7
34,440 XP
Jan
04
2 weeks ago
Activity icon

Replied to Auth Guard Sanctum Not Defined

@krie9er are you sure you published the Sanctum configuration files?

https://laravel.com/docs/8.x/sanctum#installation

Jan
03
2 weeks ago
Activity icon

Replied to Trigger Onchange Vue

@chron @change is only triggered when there is a change from the input element.

I would suggest that you check the watchers instead https://vuejs.org/v2/guide/computed.html#Watchers

Dec
18
1 month ago
Activity icon

Awarded Best Reply on How To Add A Prefix To A Custom Blade Component.

@embee have you tried:


$this->callAfterResolving(BladeCompiler::class, function () {
            Blade::component('base-input-container', BaseInputContainer::class);
            Blade::component('sunfire-base-input-container', BaseInputContainer::class);
});
Dec
17
1 month ago
Activity icon

Replied to Eloquent - Insert If Not Exists

@andyandy you can use firstOrCreate

foreach ($XML as $item) {
    PossibleCombinationsOfProductAndVariant::firstOrCreate([
        'product' => $item->product_name,
        'variant' => $item->variant_name
    ]);
}
Activity icon

Awarded Best Reply on How To Print Foreign Data Values?

@warpig I think you have to call the tags inside the post? like this:

@foreach ($post->tags as $tag)
	<span><p class="date"> {{ $tag->name }} </p></span>
@endforeach

In your Post Model:

public function tags() {
	return $this->belongsToMany(Tag::class);
}

In your Tag Model:

public function posts() {
	return $this->belongsToMany(Post::class);
}
Activity icon

Replied to How To Add A Prefix To A Custom Blade Component.

@embee I'm not sure if I can answer this correctly as I'm not familiar yet with Jetstream but if you look closely, the second parameter of Blade::component in your code is a class, but in Jetstream, it looks like it's another component that seems "aliasing" another component (as I said, I might be wrong). But to test this out you could try:

$this->callAfterResolving(BladeCompiler::class, function () {
            Blade::component('base-input-container', BaseInputContainer::class);
            Blade::component('sunfire-base-input-container', 'base-input-container'); // here
});

Because 'jet-'.$component seems already configure by Jetstream itself, so if you want to change it to sunfire you might need to do it like this:

Blade::component('jetstream::components.'.$component, 'jet-'.$component); // leave it here
Blade::component('sunfire::components.'.$component, 'jet-'.$component);
Blade::component('sunfire-'.$component, 'jet-'.$component);

Again, I might be wrong, I haven't tried this.

Also, please mark the answer "Best Answer" if you find it helpful so others can benefit from it to ;)

Activity icon

Replied to How To Add A Prefix To A Custom Blade Component.

@embee have you tried:


$this->callAfterResolving(BladeCompiler::class, function () {
            Blade::component('base-input-container', BaseInputContainer::class);
            Blade::component('sunfire-base-input-container', BaseInputContainer::class);
});
Activity icon

Replied to Filter Product's Price By Regular Price If Sale Price Is Empty?

@james_bhatta

DB::table('products')->selectRaw('COALESCE(sale_price, regular_price) as price')->get();
Activity icon

Replied to Fail To Pass User Selected Data To PDF View Laravel DOMPDF

well looks like you are submitting in the correct path? but your controller might be the problem?

Activity icon

Replied to Email Is Getting Sent Multiple Times In Laravel

@shiva how about instead, get the outstanding post on the User model instead of Post? So you can create a relationship on the User model like:

User Model:

public function outstandingPosts()
{
	return $this->hasMany(Post::class)
				->where('status', 'Waiting on Moderator')
                                ->orWhere('status', 'Waiting on User')
                                ->orWhere('status', 'Moderator Rejected');
}

Then

$outstandingPosts = User::has('outstandingPosts')->get();

    foreach($outstandingPosts as $user)                            
    {

        // Get all the posts that is attached to either a moderator or a poster
        $op = Post::where('moderator_id', $user->id)
                    ->orWhere('poster_id', $user->id)
                    ->get();   

        // Send email to that user with their outstanding posts
        Mail::to($user->email)->queue(new OutstandingPosts($op));
    }

Activity icon

Replied to Fail To Pass User Selected Data To PDF View Laravel DOMPDF

@mariaaa can you post here the error? and what URL you landed on? check where you got redirected.

Activity icon

Replied to How To Print Foreign Data Values?

@warpig I think you have to call the tags inside the post? like this:

@foreach ($post->tags as $tag)
	<span><p class="date"> {{ $tag->name }} </p></span>
@endforeach

In your Post Model:

public function tags() {
	return $this->belongsToMany(Tag::class);
}

In your Tag Model:

public function posts() {
	return $this->belongsToMany(Post::class);
}
Activity icon

Replied to HTML/CSS To PDF Library

@anandi what seems to be the problem with the packages you mentioned?

Activity icon

Replied to Email Is Getting Sent Multiple Times In Laravel

Have you tried adding groupBy?

$outstandingPosts = Post::where('status', 'Waiting on Moderator')
                                ->orWhere('status', 'Waiting on User')
                                ->orWhere('status', 'Moderator Rejected')
				->groupBy('moderator_id', 'poster_id')
                                ->get();
Activity icon

Awarded Best Reply on Unable To Locate Publishable Resources.

@iroxbir try:

php artisan clear-compiled
composer dump-autoload

and re-run your publishing

Activity icon

Replied to Email Is Getting Sent Multiple Times In Laravel

@shiva looks like your $outstandingPosts contains duplicate $user.

Can you share your Post Model?

Activity icon

Replied to Unable To Locate Publishable Resources.

Try clearing your config as well:

php artisan config:clear
Activity icon

Replied to Unable To Locate Publishable Resources.

What Laravel version you are using?

Activity icon

Replied to Fail To Pass User Selected Data To PDF View Laravel DOMPDF

@mariaaa the onclick="location.href = '/home/billing/pdf';" seems to be the problem, it's redirecting to that url before the ajax request happens.

What you can do is to add the location.href to the success method of your ajax request.

success:function(data){
	location.href = '/home/billing/pdf'; 
        // or window.location 
},
Activity icon

Replied to Unable To Locate Publishable Resources.

@iroxbir try:

php artisan clear-compiled
composer dump-autoload

and re-run your publishing

Activity icon

Awarded Best Reply on QR Code

@rabeedmenam you can use this package to create the QR code https://github.com/SimpleSoftwareIO/simple-qrcode. You can't change the text that is generated from the QR code though.

But if what you meant is the content of the URL you are generating then it's possible on the server-side. An example is when you hit domain.com/content/1, then just change its content on the DB.

Dec
16
1 month ago
Activity icon

Replied to Relation Conditions

@kshitizmittal if your goal is to just dynamically change those static values then you could do:

$band = 1;
$level = 1;
$appraisalForm = AppraisalTemplate::where(['id' => $id])->with(['goals', 'questions', 'competencies.parameterDetails.categoryDetails','departmentDetails','designationDetails.positionDetails','competencies.parameterDetails.questions'=>function($query) use ($band, $level){
            $query->where(['band'=>$band,'level'=>$level]);
        }])->first();

Just pass the variables in the use() section.

Activity icon

Replied to User Authentication From Other Domain

@kubitomakita looks like you haven't configured your CORS, check here: https://laravel.com/docs/8.x/sanctum#cors-and-cookies

Activity icon

Replied to Php Artisan Error(failed To Open Stream: No Such File Or Directory)

@mastertech01 you might think that your composer install was a success but wasn't mainly because your PHP version is not compatible?

On this package, it requires PHP 7.2.5.

Check your PHP version first.

Activity icon

Replied to Php Artisan Error(failed To Open Stream: No Such File Or Directory)

@mastertech01 looks like your composer install wasn't successful at all.

require(C:_project\web\prediction/vendor/autoload.php): failed to open stream: No such file or directory in C:_project\web\prediction\artisan on line 18 this error means you don't have the vendor/autoload.php which can be only generated via composer.

Are you sure you are in the correct directory?

Dec
12
1 month ago
Activity icon

Replied to Url Methods In Laravel

@erfanwd Don't forget to mark an answer as the best answer if it answers your question ;) Thanks!

Activity icon

Replied to Url Methods In Laravel

Well, it looks different from what you just said earlier. Looks like what you need is to create each Model on each category like Poster and T-shirts because each contains different attributes as well.

Or create a Products table that contains all the categories, so product table will have a category column which contains poster, tshirt and maybe linked to a meta table (like Wordpress) that contains the custom attribute.

products table

id | name | category
1  | test 1 | tshirt
2  | test 2  | poster    
etc...

meta table

id | product_id | key | value
1   |  1        | size | medium
2    |  1        | price | 50
3    |  2         | color   | blue
etc...
Activity icon

Replied to Url Methods In Laravel

Are the products will come in a single model (in other words, products table?) or different Models like Poster, TShirt, etc?

Activity icon

Replied to Laravel Nova Updated Courses

@boubou I suggest not touch the base code but implement your own. For example, if you want to update the login logic, you can add the same routes in your web.php and those will be overwritten.

You can check the list of nova routes using php artisan route:list and add it to your web.php with your custom controller.

Activity icon

Replied to Url Methods In Laravel

@erfanwd if I understand correctly, you want to get the my-fine-art-name depending on the model which is the product-typethat can be poster, t-shirt etc...

web.php

Route::get('/product/{$product}', function($product){
	if (request('product-type') == 'poster') {
		return Poster::where('product_name', $product)->first();
	}

	// other if condition here for t-shrit, etc...
});
Activity icon

Replied to QR Code

@rabeedmenam you can use this package to create the QR code https://github.com/SimpleSoftwareIO/simple-qrcode. You can't change the text that is generated from the QR code though.

But if what you meant is the content of the URL you are generating then it's possible on the server-side. An example is when you hit domain.com/content/1, then just change its content on the DB.

Activity icon

Replied to Spatie Permission Sync Error

@aavinseth I think you need to add protected $guard_name = 'web,auth' in your Model.

Activity icon

Replied to Openssl_pkcs7_sign(): Error Getting Private Key

@ado666 can you add the following:

$certificate = 'file://' . realpath('/var/www/xx/xx/cert/3ecs_sign.crt');

or if not, try this:

$certificate = __DIR__ . realpath('/var/www/xx/xx/cert/3ecs_sign.crt');
Activity icon

Replied to Looking To Design The Best Eloquent Relationship Between A User, A Service And Service Options.

@cosminc looks like those models are chain with one another, you can do this:

User.php

public function services()
{
	return $this->hasMany('App\Service')->with('options');
}

Service.php

public function options()
{
	return $this->hasMany('App\Option');
}

Option.php

public function service() 
{
	return $this->belongsTo('App\Service');
}

so you can loop on $users->services and loop the options inside the services.

Dec
10
1 month ago
Activity icon

Replied to Get Root URL From UrlGenerator

@rushita not sure what you meant by root but url()->full() is what you are looking for?

Activity icon

Replied to How Can I Clone Row And Relationship Into Another Table?

@crazylife I think you have to loop all the relationship like this:

$old = $order->replicate();
$old->save();

foreach($order->items as $item)
{
    $old->items()->attach($item);
}

foreach($order->history as $history)
{
    $old->history()->attach($history);
}
$old->push();

Activity icon

Replied to Laravle Where() And OrWhere() Not Working Properly.

@alexgodbehere79 try:

return LinkRelation::where(function ($query) {
            $query->where([
                'source_key' => 2,
                'target_key' => 4
            ])->orWhere([
                'source_key' => 4,
                'target_key' => 2,
            ]);
        })->first();
Dec
09
1 month ago
Activity icon

Replied to How Can I Get Only Last Product Meta Of These Dates?

@kfazil have you tried:

$data = Product::with([ 'productMeta' => function ($query) use ($date_1, $date_2) {
	$query->whereDate('date_column', $date_1)
		->orWhereDate('date_column', $date_2)
		->latest()
		->first(); 
}])->orderBy('created_at', 'desc')->get();

Dec
07
1 month ago
Activity icon

Awarded Best Reply on Laravel Version Upgrade

@deepak475121 depends on your project, does it need an update? Why?

In my case, we are running Laravel 4.2 projects without a problem but decided to upgrade some to 8.0 because we need to use a package that requires a higher Laravel version.

And if you decide to upgrade, I would suggest you install a fresh Laravel and manually copy your files instead of upgrading your version inside your project. It will also help if you have PHPUnit test in place so you check if your project works as expected.

Alternatively, you can use Laravel Shift https://laravelshift.com/

Activity icon

Replied to Laravel Version Upgrade

@deepak475121 depends on your project, does it need an update? Why?

In my case, we are running Laravel 4.2 projects without a problem but decided to upgrade some to 8.0 because we need to use a package that requires a higher Laravel version.

And if you decide to upgrade, I would suggest you install a fresh Laravel and manually copy your files instead of upgrading your version inside your project. It will also help if you have PHPUnit test in place so you check if your project works as expected.

Alternatively, you can use Laravel Shift https://laravelshift.com/

Dec
03
1 month ago
Activity icon

Replied to Php Artisan Serve

@mupenzi make sure you add those classes in your config/app.php

Add this in your providers array

Mpociot\BotMan\BotManServiceProvider::class,

And in the aliases array

'BotMan' => Mpociot\BotMan\Facades\BotMan::class

Try it and if it still doesn't work composer dump-autoload might help as well.

Dec
01
1 month ago
Activity icon

Replied to Laravel Variable From Edit Become Blank

@obink instead of doing the findOrFail manually, try to check your route by running php artisan route:list. Find the route for your Homeworks and you will see the parameter that I'm talking about. Then you can pass it to the edit function like:

public function edit(Homeworks $homework)

where $homework is the name of the parameter in the route list.

But glad it works with your solution.

Activity icon

Replied to Livewire Many Input Fields

@amitshrestha221 what I do instead is create an array property like this:

public $myform = [];

And in my form:

<input type="text" wire:model="myform.title">
<input type="text" wire:model="myform.body">
<input type="text" wire:model="myform.etc">
Activity icon

Replied to Laravel Variable From Edit Become Blank

@obink you have a route model binding situation right here.

I think it's working as expected although you need to make sure that the id you pass in your route is correct and also named properly.

Can you check your route for admin.homeworks.edit? The parameter there should be the same as your public function edit(Homeworks $homeworks) in other words, it should be named homeworks like this:

Route::get('homeworks/edit/{homeworks}', [HomeworkController::class, 'edit']);
Nov
30
1 month ago
Activity icon

Replied to Nginx Point To Public

@jlrdw if you want to point your server to the public directory of your laravel project, you can just set the root directory like this inside the server

server {
	root /var/www/your-laravel-project/public;
	// your other configurations...
}