agilasadi

agilasadi

Software Engneer at Raplet

Member Since 2 Years Ago

Azerbaijan, Lankaran

Experience Points
7,900
Total
Experience

2,100 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
63
Lessons
Completed
Best Reply Awards
0
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.

Level 2
7,900 XP
18 Sep
2 days ago

agilasadi left a reply on Update And Performance Optimisation

It will update, to confirm that you can try updating the data and check the database to see if updated_at field changes.

agilasadi started a new conversation GetActionMethod() In __construct Breaks `php Artisan Route:list`

So recently I used the getActionMethod() function on my controller __construct(), it seems to work properly, but when I run php artisan route:list it throws Call to a member function getActionMethod() on null.

Here is my usage:


$this->method = request()->route()->getActionMethod()

24 Aug
3 weeks ago

agilasadi left a reply on How To Publish And Register An Extra Service Provider In Laravel Package

I see I will give it a shot in the next update.

22 Aug
4 weeks ago

agilasadi left a reply on How To Publish And Register An Extra Service Provider In Laravel Package

Ok, so this service provider enables the functionality to manage authentication method, I would like to modify it once I pull in package.

The above code is an example, I know how to register a service provider, and I know it won't work.

But somehow in Nova there is a NovaServiceProvider that gets published and registered. I could not entirely figure it out.

agilasadi started a new conversation How To Publish And Register An Extra Service Provider In Laravel Package

I would like to publish an extra service provider into App/Providers/ and then register it. The problem is I'm supposed to register it in register() function while I should publish it in boot() function. How should I accomplish that?

Here is what I'm going to publish:

public function boot()
{
    if ($this->app->runningInConsole())
    {
        $this->publishes([
            __DIR__ . '/Console/stubs/SomeServiceProvider.stub' => 
            app_path('Providers/SomeServiceProvider.php'),
        ], 'wire-provider');
    }
}

Here is how I would presumably register it if was published properly:

public function register()
{

    $this->app->register(App\Providers\SomeServiceProvider::class);
}

I would like to point this out, this service provider is not the main service provider for the package, and it's not in the project by default, it should be published first.

17 Aug
1 month ago

agilasadi left a reply on When A Route URL Is Same As The Package Name, That URL Does Not Work

The only thing in middleware is that it checks to see if the user is authenticated. On the other hand, I think you might have detected the issue, there is folder called wire in public directory :/ gotta rename it and try to see what happens. That is probably the issue

16 Aug
1 month ago

agilasadi left a reply on When A Route URL Is Same As The Package Name, That URL Does Not Work

This is what you are looking for. it's right there on the third line @dunsti

|        | GET|HEAD | wire                           | wire.dashboard    | App\Wire\Http\Controllers\[email protected]               | web,wire_interface |

agilasadi left a reply on When A Route URL Is Same As The Package Name, That URL Does Not Work

+--------+----------+--------------------------------+-------------------+-----------------------------------------------------------------------+--------------------+ | Domain | Method | URI | Name | Action | Middleware | +--------+----------+--------------------------------+-------------------+-----------------------------------------------------------------------+--------------------+ | | GET|HEAD | / | | Closure | web | | | GET|HEAD | api/user | | Closure | api,auth:api | | | GET|HEAD | wire | wire.dashboard | App\Wire\Http\Controllers\[email protected] | web,wire_interface | | | GET|HEAD | wire/login | wire.login | App\Wire\Http\Controllers\Authentication\[email protected] | web | | | POST | wire/login | wire.attemptLogin | App\Wire\Http\Controllers\Authentication\[email protected] | web | | | GET|HEAD | wire/logout | wire.logout | App\Wire\Http\Controllers\Authentication\[email protected] | web,wire_interface | | | GET|HEAD | wire/{identifier} | wire.index | App\Wire\Http\Controllers\[email protected] | web,wire_interface | | | POST | wire/{identifier} | wire.store | App\Wire\Http\Controllers\[email protected] | web,wire_interface | | | GET|HEAD | wire/{identifier}/create | wire.create | App\Wire\Http\Controllers\[email protected] | web,wire_interface | | | GET|HEAD | wire/{identifier}/recycle | wire.recycle | App\Wire\Http\Controllers\[email protected] | web,wire_interface | | | GET|HEAD | wire/{identifier}/restore/{id} | wire.restore | App\Wire\Http\Controllers\[email protected] | web,wire_interface | | | GET|HEAD | wire/{identifier}/show/{id} | wire.show | App\Wire\Http\Controllers\[email protected] | web,wire_interface | | | DELETE | wire/{identifier}/{id} | wire.destroy | App\Wire\Http\Controllers\[email protected] | web,wire_interface | | | PUT | wire/{identifier}/{id} | wire.update | App\Wire\Http\Controllers\[email protected] | web,wire_interface | | | GET|HEAD | wire/{identifier}/{id}/edit | wire.edit | App\Wire\Http\Controllers\[email protected] | web,wire_interface | +--------+----------+--------------------------------+-------------------+-----------------------------------------------------------------------+--------------------+

agilasadi left a reply on When A Route URL Is Same As The Package Name, That URL Does Not Work

No, it does not, I'm trying it in a new laravel application. And actually tried in multiple applications

agilasadi left a reply on When A Route URL Is Same As The Package Name, That URL Does Not Work

It throwes The requested resource /wire was not found on this server.

agilasadi left a reply on When A Route URL Is Same As The Package Name, That URL Does Not Work

Yeap, that is exactly what I'm trying to say :)

agilasadi left a reply on When A Route URL Is Same As The Package Name, That URL Does Not Work

I'm telling by route name, can you please Ctrl+f wire.dashboard

agilasadi left a reply on When A Route URL Is Same As The Package Name, That URL Does Not Work

wire.dashboard route is before {identifier} route, I would expect it to be run before it

agilasadi left a reply on When A Route URL Is Same As The Package Name, That URL Does Not Work

No problem, here is what my rout looks like currently

<?php
Route::group(['namespace' => 'App\Wire\Http\Controllers', 'middleware' => 'web', 'prefix' => 'wire'], function () {
    Route::get('login', 'Authentication\[email protected]')->name('wire.login');
    Route::post('login', 'Authentication\[email protected]')->name('wire.attemptLogin');

    Route::group(['middleware' => 'wire_interface'], function () {
            Route::get('/', '[email protected]')->name('wire.dashboard');

            Route::get('logout', 'Authentication\[email protected]')->name('wire.logout');

            Route::get('{identifier}', '[email protected]')->name('wire.index');
            Route::post('{identifier}', '[email protected]')->name('wire.store');
            Route::get('{identifier}/create', '[email protected]')->name('wire.create');
            Route::get('{identifier}/recycle', '[email protected]')->name('wire.recycle');
            Route::get('{identifier}/restore/{id}', '[email protected]')->name('wire.restore');
            Route::delete('{identifier}/{id}', '[email protected]')->name('wire.destroy');
            Route::put('{identifier}/{id}', '[email protected]')->name('wire.update');
            Route::get('{identifier}/show/{id}', '[email protected]')->name('wire.show');
            Route::get('{identifier}/{id}/edit', '[email protected]')->name('wire.edit');
    });
});

In this case, wire.dashboard route would not work

15 Aug
1 month ago

agilasadi left a reply on Laravel 5 Package ServiceProvider Can't Be Found!

I'm running into a similar problem, know it has changed quite a bit since then.

I'm trying to make my first package as well.

Here is the package URL in Packagist: https://packagist.org/packages/rapkit/wire

and this is the GitHub URL: https://github.com/rapkit/wire

I tried a few things to fix it but now I have no idea about what to do. also, I don't want to do a lot of unnecessary pushes to the repository.

Since it's working in my development environment but when I try to pull it into a new project, it starts throwing ServiceProvider not founded error.

14 Aug
1 month ago

agilasadi started a new conversation When A Route URL Is Same As The Package Name, That URL Does Not Work

I have a lot of URLs in my package routes, but one of them does not seem to work. When the route is as follows:


Route::get('package_name', '[email protected]');

It does not work, if I try to access localhost:8000/package_name then I get:

The requested resource /package_name was not found on this server.,

but when it's something as below:


Route::get('something', '[email protected]');

Then it works with no problem.

Also, when I run php artisan route:list the route is there as expected.

12 Aug
1 month ago

agilasadi commented on Package Development

I would love to see an updated version of this video

09 Aug
1 month ago

agilasadi left a reply on [L5] Register A Route Middleware At Package

Did that change since than?

22 Jun
2 months ago

agilasadi left a reply on Listen To *any* Save/update/create Event For *any* Model?

@KFIRBA - I don't think those events would work that way, whenever I place another event within the same trait, it no longer listens to the remaining part of the trait

01 Jun
3 months ago

agilasadi left a reply on It Seems Like Laravel Boot Trait Doesn't Work

Here is what I ended up doing, works perfectly well


    public static function boot()
    {
        self::created(
            function($model)
            {
                Contribution::create([
                    'contributing_id' => $model->id,
                    'contributing_type' => $model->table
                ]);
            }
        );
    }

agilasadi left a reply on It Seems Like Laravel Boot Trait Doesn't Work

Here is the thing, dd() works inside the trait, but it does not work inside the static::creating

agilasadi left a reply on It Seems Like Laravel Boot Trait Doesn't Work

@TALINON - No, I do not have boot in my model

agilasadi left a reply on It Seems Like Laravel Boot Trait Doesn't Work

@SNAPEY - If it has the id or not, just to make sure creating the record is successful, but the code doesn't reach to that point, creating does not get triggered

agilasadi left a reply on It Seems Like Laravel Boot Trait Doesn't Work

@SNAPEY - It's quite the same as mine, but for some reason, it doesn't work. By the way, I think this method feels a lot cleaner

agilasadi left a reply on It Seems Like Laravel Boot Trait Doesn't Work

@JOHNBRAUN - Nothing, it ignores the event entirely, but when I put dd before the event, it shows up when the page is loading

agilasadi started a new conversation It Seems Like Laravel Boot Trait Doesn't Work

Recently I'm having problems with using traits, I created some before and it seemed to work, but now I created another one to take action on a creating event, here it is


trait Contributes
{

public static function bootContributes()
{
    static::creating(function ($model) {
        if (!$model->getKey())
        {
            Contribution::create([
                'contributing_id' => $model->id,
                'contributing_type' => $model->class_table,
            ]);
        }
    });
}

}

and I included it in multiple models like use Contributes; I think there is something I don't know about it.

31 May
3 months ago

agilasadi started a new conversation Laravel Nova Access Restriction Vie Gate Does Not Work

I tried to restrict access to Nova depending on user role. Although It seems like I did everything according to the documentation, Nova seems to ignore it.

    protected function gate()
    {
        Gate::define('viewNova', function ($user) {
            return in_array($user->role_id, [
                '1'
            ]);
        });
    }
16 May
4 months ago

agilasadi left a reply on Nova Actionable_id Cannot Be Null

@DEVFREY - Shoot, that is it. :D Thanks for your assistance <3

agilasadi left a reply on Nova Actionable_id Cannot Be Null

@DEVFREY - I didn't try that be clearly, generating guid with a trait was the problem. It worked just by disabling the trait which I'm absolutely not happy with :/

agilasadi left a reply on Nova Actionable_id Cannot Be Null

So here is the trait I added for the Model:

trait UsesUuid
{
    protected static function bootUsesUuid()
    {
        static::creating(function ($model) {
            if (!$model->getKey())
            {
                $model->guid = (string)Str::uuid();
            }
        });
    }

    public function getIncrementing()
    {
        return false;
    }

    public function getKeyType()
    {
        return 'string';
    }
}

it seems like disabling trait lets this work.

How else I can generate the guid field?

agilasadi left a reply on Nova Actionable_id Cannot Be Null

@devfrey here is the fields for the Site resource:


            ID::make()
                ->hideWhenCreating()
                ->hideWhenUpdating(),

            Text::make('Guid')
                ->withMeta(['value' => (string)Str::uuid()]),

            Text::make('Site Title')
                ->creationRules('required'),

            Text::make('Site Contents')
                ->creationRules('required'),

            Number::make('Record Priority'),

            Select::make('Record State')->options([
                '1' => 'Active',
                '0' => 'Disabled',
                '2' => 'Draft',
            ])->displayUsingLabels(),

            BelongsTo::make('Created By', 'creator', 'App\Nova\User')
                ->creationRules('required'),

            BelongsTo::make('Updated By', 'updater', 'App\Nova\User')
                ->creationRules('nullable'),

            HasMany::make('Sites', 'roles', 'App\Nova\RoleSites')

I can share model as well if you want to see it

agilasadi left a reply on Nova Actionable_id Cannot Be Null

@munazzil As @devfrey mentioned, it's created_by which corresponds to the creator of the record

agilasadi left a reply on Nova Actionable_id Cannot Be Null

@devfrey As far as I remember I didn't do anything like that

agilasadi started a new conversation Nova Actionable_id Cannot Be Null

Apparently none of my create functions is working, the all keep throwing:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'actionable_id' cannot be null (SQL: insert into `action_events` (`batch_id`, `user_id`, `name`, `actionable_type`, `actionable_id`, `target_type`, `target_id`, `model_type`, `model_id`, `fields`, `status`, `exception`, `updated_at`, `created_at`) values (8db303d9-39ca-4858-8d59-30ec1cd51cb7, 1, Create, App\Models\Site, ?, App\Models\Site, ?, App\Models\Site, ?, , finished, , 2019-05-16 09:47:12, 2019-05-16 09:47:12))

Basically, it says 'actionable_id' can not be 'null'`.

Here is a sample of my table:


            $table->bigIncrements('id');
            $table->string('guid')->unique();

            $table->string('site_title');

            $table->string('site_contents')->nullable();

            $table->integer('record_priority')->default('0');
            $table->integer('record_state')->default('1');
            $table->string('created_by');
            $table->string('updated_by')->nullable();

            $table->softDeletes();
            $table->timestamps();

I generate guid with trait, but for the sake of making this work, I even tried it manually, no luck.

It works just fine when I create it with tinker.

13 May
4 months ago

agilasadi left a reply on Fields In Nova For Inserting Data With Child Table

I see thanks for your help <3

agilasadi left a reply on Fields In Nova For Inserting Data With Child Table

Should I also have a model and Nova Resource for the child table?

agilasadi left a reply on Fields In Nova For Inserting Data With Child Table

How am I going to have multiple fields for inserting that role translations?

agilasadi started a new conversation Fields In Nova For Inserting Data With Child Table

I have quite a little experience with the capabilities of Nova, but recently I started working on a multi-lingual application with Nova. Here is the point where I got stuck.

My table structure is somewhat like below:


        Schema::create('roles', function (Blueprint $table) {
            $table->bigIncrements('auto_id');
            $table->string('id');

            $table->timestamps();
            $table->softDeletes();
        });

        Schema::create('role_translation', function (Blueprint $table) {
            $table->string('role_id');
            $table->string('translation_id');

            $table->string('role_name');
            $table->string('role_description')->nullable();

            $table->string('created_by');
            $table->string('updated_by')->nullable();

            $table->timestamps();
            $table->softDeletes();
        });

Now when I insert into roles I also need to insert into role_translations I don't know how to provide fields for Nova to give me the desired interface.

agilasadi left a reply on Hasone RelationsShip (Create View) - Laravel Nova

I don't feel comfortable with this solution, to be honest. But thanks for sharing.

04 May
4 months ago

agilasadi left a reply on Weird Behaviour On Paginating With Join And `having` Clause

Just to let you know, the code you have given is kind of not readable :/

11 Apr
5 months ago

agilasadi left a reply on PhpDoc In Laravel

@MSTNORRIS - But ApiGen is used for generating API documentation, like swagger. phpDocumentor is used for generating code documentation out of code blocks

27 Mar
5 months ago

agilasadi left a reply on Installing Nova 2.0 On Laravel 5.8 Is Throwing Errors

Ok that actually did it, my bad. thanks for helping me out

agilasadi left a reply on Installing Nova 2.0 On Laravel 5.8 Is Throwing Errors

You mean bcmath right? If so, I'm able to see it

agilasadi started a new conversation Installing Nova 2.0 On Laravel 5.8 Is Throwing Errors

I followed the guide from Nova documentation. after adding the required lines into composer.json I tried to run composer update and this is what I get:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/nova 2.0.x-dev requires moontoast/math ^1.1 -> satisfiable by moontoast/math[1.1.0, 1.1.1, 1.1.2].
    - laravel/nova dev-master requires moontoast/math ^1.1 -> satisfiable by moontoast/math[1.1.0, 1.1.1, 1.1.2].
    - moontoast/math 1.1.2 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
    - moontoast/math 1.1.1 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
    - moontoast/math 1.1.0 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
    - Installation request for laravel/nova * -> satisfiable by laravel/nova[2.0.x-dev, dev-master].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.2/cli/php.ini
    - /etc/php/7.2/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.2/cli/conf.d/10-opcache.ini
    - /etc/php/7.2/cli/conf.d/10-pdo.ini
    - /etc/php/7.2/cli/conf.d/15-xml.ini
    - /etc/php/7.2/cli/conf.d/20-bz2.ini
    - /etc/php/7.2/cli/conf.d/20-calendar.ini
    - /etc/php/7.2/cli/conf.d/20-ctype.ini
    - /etc/php/7.2/cli/conf.d/20-curl.ini
    - /etc/php/7.2/cli/conf.d/20-dom.ini
    - /etc/php/7.2/cli/conf.d/20-exif.ini
    - /etc/php/7.2/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.2/cli/conf.d/20-ftp.ini
    - /etc/php/7.2/cli/conf.d/20-gd.ini
    - /etc/php/7.2/cli/conf.d/20-gettext.ini
    - /etc/php/7.2/cli/conf.d/20-iconv.ini
    - /etc/php/7.2/cli/conf.d/20-json.ini
    - /etc/php/7.2/cli/conf.d/20-mbstring.ini
    - /etc/php/7.2/cli/conf.d/20-mysqli.ini
    - /etc/php/7.2/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.2/cli/conf.d/20-phar.ini
    - /etc/php/7.2/cli/conf.d/20-posix.ini
    - /etc/php/7.2/cli/conf.d/20-readline.ini
    - /etc/php/7.2/cli/conf.d/20-shmop.ini
    - /etc/php/7.2/cli/conf.d/20-simplexml.ini
    - /etc/php/7.2/cli/conf.d/20-sockets.ini
    - /etc/php/7.2/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.2/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.2/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.2/cli/conf.d/20-tokenizer.ini
    - /etc/php/7.2/cli/conf.d/20-wddx.ini
    - /etc/php/7.2/cli/conf.d/20-xmlreader.ini
    - /etc/php/7.2/cli/conf.d/20-xmlwriter.ini
    - /etc/php/7.2/cli/conf.d/20-xsl.ini
    - /etc/php/7.2/cli/conf.d/20-zip.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

any help is appreciated in advance.

04 Mar
6 months ago

agilasadi left a reply on Getting Error In Container.php Line 779: Class Request Does Not Exist

We can help you better if you share some of the code, it's hard to guess. Other than that as @bobbybouwmann mentioned, you might have defined Request class wrongly

agilasadi left a reply on Nova: How Do I Check Whether The User Is Inside The Admin Panel?

I don't have much experience with Nova but if you have multiple guards you can check that by @if(Auth::guard('type')->check())

23 Feb
6 months ago

agilasadi started a new conversation Carbon Throwing Errors In Lamp Server

Laravel is throwing Class Carbon not found, I created the application in local environment and it's working, but when I deployed it to digitalocean server, it doesn't seem to work. here is the code:

{{ \Carbon\Carbon::parse($entity['start_date'])->format('d') }}

And we also tried:

{{ Carbon::parse($entity['start_date'])->format('d') }}

And here is the error it throws:

Class 'Carbon' not found (View: /var/www/html/resources/views/common/components/single_slider_event.blade.php) (View:

And the alies is set up correctly:

'aliases' => [
      'Carbon' => Carbon\Carbon::class,
],

Any help is appreciated in advance.