Ricus

Ricus

Member Since 5 Years Ago

Experience Points
10,150
Total
Experience

4,850 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
84
Lessons
Completed
Best Reply Awards
5
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.

Level 3
10,150 XP
Jun
30
1 month ago
Activity icon

Awarded Best Reply on

Hi @nidal

Sounds like you want to convert something you wrote in to it's own package.

Laracasts has a video series on package development here: https://laracasts.com/lessons/package-development-101

There are also a bunch of articles on the internet if you search for laravel package development. We've done this on a few of our projects, it's nice to abstract a piece of functionality in to it's own package.

Edit: @nidal You can read more about this on the laravel docs here: https://laravel.com/docs/7.x/packages

Mar
08
5 months ago
Activity icon

Awarded Best Reply on Mutating Props Vue.js

You could set a data property to the value of the prop, essentially making a copy of it.

 export default {
        props: ['active'],
	data() {
		return {
			isActive:this.active
		}
	},
        computed: {
            classes() {
                return ['btn', this.isActive? 'btn-primary' : 'btn-default'];
            }
        },
        methods: {
            subscribe() {
                axios[
                    (this.isActive? 'delete' : 'post')
                ](location.pathname + '/subscriptions');
                this.isActive = ! this.isActive;
            }
        }
    }

Then base your logic of the data property, think of the prop as like a constructor for that data prop.

Your axios call will then update this.isActive and you will not get the prop mutation warning.

Activity icon

Replied to Sum Function In Laravel Vuejs Using Raw Slq

@usmanbasharal you defined getstocks as an array, and then pushed one item to the array.

Now when you output it here <div class="count" >{{getstocks}}</div> you are outputting array, hence the ["30"]

Activity icon

Replied to Integrating Map In Laravel

@ilhamzacky Yes it's possible

Activity icon

Replied to

Hi @nidal

Sounds like you want to convert something you wrote in to it's own package.

Laracasts has a video series on package development here: https://laracasts.com/lessons/package-development-101

There are also a bunch of articles on the internet if you search for laravel package development. We've done this on a few of our projects, it's nice to abstract a piece of functionality in to it's own package.

Edit: @nidal You can read more about this on the laravel docs here: https://laravel.com/docs/7.x/packages

Activity icon

Replied to Integrating Map In Laravel

You need to provide more information on your issue please. How are you storing the locations? Are you using Vue or something else for the front-end?

Short answer is yes it's possible, but you left out a lot of details

Activity icon

Replied to Laravel Nova Broken When Setup On Existing Vue-SPA App

@aligajani If you don't already have some before check on your policies for an admin account you will need to go add those. This might also come in useful in your project at a later stage.

Personally for roles and permissions I normally go for Spatie's permission spackage: https://github.com/spatie/laravel-permission

Nice thing of this is that there is also a Laravel Nova package for this over at https://novapackages.com/

Nova package: https://novapackages.com/packages/vyuldashev/nova-permission

After installing the above packages managing your roles and permissions will be a breeze. Your ->isSuperAdmin() calls would then change to something like $user->hasRole("admin"); or something similar.

You could also leverage the permissions package for determining who can use nova based on a permission, for instance $user->can('use-nova'); and use that in your gate.

This permission and giving it to users can be manages from the nova package

Activity icon

Replied to Laravel Nova Broken When Setup On Existing Vue-SPA App

@aligajani Nova uses your existing policies to determine if the logged in user can perform any crud operation on a resource.

If you have existing policies linked to Models, Nova will use them, have a look here https://nova.laravel.com/docs/2.0/resources/authorization.html#policies

Activity icon

Replied to Laravel Nova Broken When Setup On Existing Vue-SPA App

@aligajani Correct Nova uses it's own code for login / reset and everything else. All you need to do is change the config file, create some Nova Resources and you are good to go.

Activity icon

Awarded Best Reply on Laravel Nova Broken When Setup On Existing Vue-SPA App

@aligajani which issue do you still have left now?

Locally Nova allows any user to log in, as long as the user can be logged in with the guard defined.

Have a look at the guard key in thenova.php config file. you can make nova use non-default guards, possibly try changing that to the same guard you use on your SPA

Activity icon

Replied to Application Not Working When Using Custom Service Provider

@spbaniya also, I noticed your bugsnag service provider is registered after your AppServiceProvider

According to the Bugsnag docs here: https://docs.bugsnag.com/platforms/php/laravel/ you need to register their provider before the AppServiceProvider

Activity icon

Replied to Application Not Working When Using Custom Service Provider

@spbaniya try registering that provider higher up in the array, it's currently right at the end.

You will notice the section with the comment Package Service Providers, move your provider there and see if it helps

Activity icon

Replied to Laravel Nova Broken When Setup On Existing Vue-SPA App

@aligajani which issue do you still have left now?

Locally Nova allows any user to log in, as long as the user can be logged in with the guard defined.

Have a look at the guard key in thenova.php config file. you can make nova use non-default guards, possibly try changing that to the same guard you use on your SPA

Activity icon

Replied to Is It Worth Using Laravel For Backend Only?

@woddell nothing open source no, all work related.

You just have to decide how you want to implemented your API auth but there's many options these days baked in to the framework.

And then like I mentioned in my previous comment we normally go with Laravel Nova for the admin panel since you will most likely need to configure some things.

Activity icon

Replied to Is It Worth Using Laravel For Backend Only?

Laravel backend with Nova for admin panel, then have a bunch of clients connecting to your api. Works like a charm

Activity icon

Replied to Laravel Nova Broken When Setup On Existing Vue-SPA App

Hi @aligajani

Nova should definitely work for your project, it doesn't care if you have a SPA as long as it can access your database and you set up the models correctly.

The first error regarding nova:user is because that command assumes a normal User model, but you can easily make any user a Nova user, that is just a convenience command.

If you look in the NovaServiceProvider the is function called gate()

function gate(){
    Gate::define("viewNova", function($user){
       //Perform some condition here that returns true or false
    }
}

This function determines which users can see and use nova, you can add a check for an existing user or role if you have that implemented.

Returning true from here gives the user the ability to use nova.

Have a look here: https://nova.laravel.com/docs/2.0/installation.html#customizing-nova-s-authentication-guard

Activity icon

Replied to Mutating Props Vue.js

You could set a data property to the value of the prop, essentially making a copy of it.

 export default {
        props: ['active'],
	data() {
		return {
			isActive:this.active
		}
	},
        computed: {
            classes() {
                return ['btn', this.isActive? 'btn-primary' : 'btn-default'];
            }
        },
        methods: {
            subscribe() {
                axios[
                    (this.isActive? 'delete' : 'post')
                ](location.pathname + '/subscriptions');
                this.isActive = ! this.isActive;
            }
        }
    }

Then base your logic of the data property, think of the prop as like a constructor for that data prop.

Your axios call will then update this.isActive and you will not get the prop mutation warning.

Activity icon

Replied to Is It Worth Using Laravel For Backend Only?

We've used laravel as the backend only service for many projects, there is definitely no reason to not do this in my opinion.

On a few occasions I've started a Lumen project, but in every case I just jump back to Laravel. The few milliseconds you gain from Lumen isn't worth the convenience you get from the full framework in my opinion.

Activity icon

Replied to I Need Help

@tochino did you give the route the name of admin.user-edit ?

Secondly, it looks like you have a route query parameter there, what is it called in the route signature?

If you paste the route from your routes file I'm sure someone here will be able to help.

Activity icon

Replied to How To External URL Image (download/ Copy)

@sabbir345 is the $sourceFilePath a url of an external image that you are trying to copy to your project?

Activity icon

Replied to Max Exution Time Error

@hasen39 could you post the code that is causing this issue?

Activity icon

Replied to Application Not Working When Using Custom Service Provider

which one of these is the new provider causing the issue?

Activity icon

Awarded Best Reply on Croning A Route

@ottaviane that doesn't look correct

There is a few approaches but the easiest is probably to go to your Kernel class (The one that extend the ConsoleKernel located at app/Console/Kernel.php)

Inside this class there is a function called schedule where you can add all your scheduled commands (https://laravel.com/docs/7.x/scheduling#scheduling-artisan-commands)

$schedule->call(function () {
          (new scadenziarioController)->getInfoPrefUser()
})->daily();

Another solution would be to create a new artisan command which performs the logic you need, and call that artisan command in your scheduler.

With an artisan command, you would have the following in your schedule method:

$schedule->command('user:get-info')->daily(); // or whatever signature you gave the command

Keep in mind both of these suggestions will only work if you have set up a cron entry to call php artisan schedule:run every minute. This is all lined out in the link I sent above

Activity icon

Replied to Application Not Working When Using Custom Service Provider

@spbaniya Please put the line that causes the error back in providers array in app.php and copy paste the contents of the file here, that way I might be able to spot some issue

Activity icon

Replied to Croning A Route

@ottaviane no problems, please do mark one of my answers as the correct / best answer to your initial question so other users can find it easily and know that the issue has been resolved

Activity icon

Replied to Application Not Working When Using Custom Service Provider

Could you post the contents of the NumberServiceProvider and also where you added it in app.php?

The error you are getting is for bugsnag which doesn't seem to have anything to do with your new service provider.

Activity icon

Replied to Croning A Route

@ottaviane see my previous reply.

This command would run every minute, but you indicated you want it to only run once a day, so then you would use daily() instead of everyMinute()

Activity icon

Replied to Croning A Route

@ottaviane that doesn't look correct

There is a few approaches but the easiest is probably to go to your Kernel class (The one that extend the ConsoleKernel located at app/Console/Kernel.php)

Inside this class there is a function called schedule where you can add all your scheduled commands (https://laravel.com/docs/7.x/scheduling#scheduling-artisan-commands)

$schedule->call(function () {
          (new scadenziarioController)->getInfoPrefUser()
})->daily();

Another solution would be to create a new artisan command which performs the logic you need, and call that artisan command in your scheduler.

With an artisan command, you would have the following in your schedule method:

$schedule->command('user:get-info')->daily(); // or whatever signature you gave the command

Keep in mind both of these suggestions will only work if you have set up a cron entry to call php artisan schedule:run every minute. This is all lined out in the link I sent above

Activity icon

Replied to How To Export Database Into Json File In Computer Like Postman

@muhammad-abubaker the whole database? What would be the use case for this?

I suggest maybe investigating in what data you actually need to export, and returning that data as JSON as opposed to the entire database which could grow to gigabytes pretty easily

Mar
07
5 months ago
Activity icon

Replied to Croning A Route

Why not just create a scheduled task that calls the function that the mentioned route would call?

For instance the getInfoPrefUserfunction does some sort of logic, and all you need to do is call this same logic from your scheduled command

Activity icon

Replied to Using Raw Sql In Laravel

Hi @usmanbasharal

Have a look at the docs here: https://laravel.com/docs/7.x/database#running-queries

You can use th DB facade to run raw queries, however you should also be able to get the results you want with Eloquent