nikocraft

Experience

25,630

5 Best Reply Awards

  • Member Since 2 Years Ago
  • 88 Lessons Completed
  • 10 Favorites

15th August, 2018

nikocraft left a reply on Using Laravel Accessors In A Vue Layout • 5 days ago

the above is the only solution, once appeneded, they will always follow :)

nikocraft started a new conversation Laravel Connection: Sqlite, Database: Memory Leads To Could Not Find Driver • 5 days ago

I'm running laravel on win10, so I cant really run

sudo apt-get install php7.1-sqlite3 as pointed out here:

Laravel - Could not find driver exception with sqlite

I am trying to run some tests with phpunit and inside one of tests I've done:

class ViewConcertListingTest extends TestCase { use DatabaseMigrations;

and inside phpunit.xml

I've added these two

<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>

What can I do to get laravel to be able to use sqlite and memory database?

11th August, 2018

nikocraft left a reply on How Does Everyone Sync Their MorphToMany Relationships? • 1 week ago

there is also morphToMany which is basically manyToMany relationship but on polymorphic models :)

If we have sync for many-to-many why not morphToMany as well?

nikocraft left a reply on How Does Everyone Sync Their MorphToMany Relationships? • 1 week ago

Maybe I am thinking wrong here, why do we for example have sync for manyToMany relationships at all in Laravel but not for morphToMany?

10th August, 2018

nikocraft left a reply on How Do I Select MorphToMany Relationship Based On The Morphable Type? • 1 week ago

you don't post for 10 months and you help me, thank you @Abi appreciated! :)

nikocraft started a new conversation How Do I Select MorphToMany Relationship Based On The Morphable Type? • 1 week ago

I want to do something like this:

Tag::where('taggable_type', 'App\Models\Core\Media\Image')->get()

Image model has Tags, which are defined like

public function tags()
{
    return $this->morphToMany(Tag::class, 'taggable');
}

And then we have two migrations

    Schema::create('tags', function (Blueprint $table) {
        $table->increments('id');
        $table->string('title');
        $table->string('slug')->unique();
        $table->timestamps();
    });

and

    Schema::create('taggables', function (Blueprint $table) {
        $table->integer('tag_id');
        $table->integer('taggable_id');
        $table->string('taggable_type');
    });

so ofc I cant do this Tag::where('taggable_type', 'App\Models\Core\Media\Image')->get()

since tag model it self does not have taggable_type, but the polymorph pivot table has. How can I query tag table but let it only return stuff where taggable_type is of this 'App\Models\Core\Media\Image'?

nikocraft started a new conversation How Does Everyone Sync Their MorphToMany Relationships? • 1 week ago

How do you sync them?

Do you just detach and then attach again? Why do we not have sync method for toMany polymorphic relationships? Is this method hard to implement correctly for polymorphic models?

2nd July, 2018

nikocraft left a reply on Setting Up Lets Encrypt On Forge • 1 month ago

hi so once this is done I can access https://mysite.com

do I need to tell laravel to run everything over https or will it automatically work? I've done this over a year ago but I forgot the details. Greatfull for any tips in case extra steps are needed after Lets Encrypt has been installed :)

1st July, 2018

nikocraft started a new conversation How To Turn Of Phpinfo On Freshly Deployed Forge Server? • 1 month ago

if server is accessed directly by ip in browser it displays phpinfo, how can this be turned off?

nikocraft left a reply on How Good Is Forge Support From Your Perspective? • 1 month ago

seems like Stripe has really some bad algorithms to block a valid bussiness card. Why does paypal never have the same problem :) I never got this with them.

nikocraft started a new conversation How Good Is Forge Support From Your Perspective? • 1 month ago

I'm wondering about Forge support, do they allways respond? I've read on reddit that some questions go unanswered, has it happened to any of you?

I've tried to sign up to business plan and I got a message saying that it failed and that I should get in touch with Stripe to check why.

I tried reaching out to Said, the guy Taylor hired as laravel first employe. I reached out to him about this on twitter 18 hours ago and he did not care to even respond.

I guess they must be too busy and dont care about some of this stuff.

What is your experience? Is support good, how long before Taylor answers? I guess he is the one answering most support questions?

27th June, 2018

nikocraft left a reply on How To Tell Laravel To Automatically Decode Urls • 1 month ago

how do I access incoming paramters and then push them back in?

TrimStrings looks like this

class TrimStrings extends Middleware
{
    /**
     * The names of the attributes that should not be trimmed.
     *
     * @var array
     */
    protected $except = [
        'password',
        'password_confirmation',
    ];
}

nikocraft started a new conversation How To Tell Laravel To Automatically Decode Urls • 1 month ago

How do I tell laravel to automatically turn this

http://laraone.oo/backend/activate/8%3Fexpires%3D1530213677

into this

http://laraone.oo/backend/activate/8?expires=1530213677

I am currently getting the first type of link when I submit something via post method from the vue, and if I remember correctly there is somewhere in laravel a place where I can enable laravel to conver all first type of links into second type of links before it starts extracting them and parsing them.

nikocraft started a new conversation How To Verify Signed Url When Submiting As Post Via Vuejs? • 1 month ago

I am using laravels signedRoutes and I have signed a route on the server and now I need to submit this route again to the server but from the client which is in javascript. Below code is what I have before I send it to the server.

                        let formData = {
                            signature: '51bd52ece280dd29857aa7443e9178e64cf27047e831f4cdfd32c951c4571f65',
                            testing: '12345',
                            expires: '1530209048',
                            user: '7',
                            password: this.password,
                            passwordConfirm: this.passwordConfirm
                        }

return axios.post(route('backend.user.activate'), formData)

When I recieve this on the server I do

    public function activate(Request $request)
    {
        if ($request->hasValidSignature()) {
            dd('we cool!');
        }

"we cool!" does not print for me, which means Laravel has problem to verify the valid signature when sent as a post.

I also tried attaching like this

return axios.post(route('backend.user.activate', urlSignature), formData)

where urlSignature="7?expires=1530209048&testing=12345&signature=51bd52ece280dd29857aa7443e9178e64cf27047e831f4cdfd32c951c4571f65"

but laravel still fails to verify that signature is valid, which it is, since it works over simple route like this

Route::get('/activate/{user}', 'Auth\[email protected]')->name('backend.user.activate.show');

but as soon as I go to post

Route::post('/activate/{user}', 'Auth\[email protected]')->name('backend.user.activate');

it fails.

I need to use the post, since I must send password in the post and I do not wish to send it via get request.

26th June, 2018

nikocraft left a reply on How To Override Auth Login Function In Laravel? • 1 month ago

@jlrdw hi, how are things in the future, are Marty and Doc still around? Is everything ok with Earths gravity?

nikocraft left a reply on How To Override Auth Login Function In Laravel? • 1 month ago

Ok this is final function if anyone from the future wonders what the solution was:

    public function login(Request $request)
    {
        $this->validateLogin($request);

        if ($this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

            return $this->sendLockoutResponse($request);
        }

        if($this->guard()->validate($this->credentials($request))) {
            if(Auth::attempt(['email' => $request->email, 'password' => $request->password, 'is_activated' => 1])) {
                // return redirect()->intended('dashboard');
            }  else {
                $this->incrementLoginAttempts($request);
                return response()->json([
                    'error' => 'This account is not activated.'
                ], 401);
            }
        } else {
            // dd('ok');
            $this->incrementLoginAttempts($request);
            return response()->json([
                'error' => 'Credentials do not match our database.'
            ], 401);
        }
    }

this part validates the correct credentials but does not login the user: if($this->guard()->validate($this->credentials($request)))

this part logs-in the user if all requirments are met:

if(Auth::attempt(['email' => $request->email, 'password' => $request->password, 'is_activated' => 1]))

nikocraft left a reply on How To Override Auth Login Function In Laravel? • 1 month ago

Actually its good except we got another problem now.

If user creditials do not match what is found in the database now user will only get back "This account is not activated." error message, which may not be true. Any idea how to solve this problem? I have to show the user correct error message.

nikocraft left a reply on How To Override Auth Login Function In Laravel? • 1 month ago

yes it was very usefull :) thanks!

Btw if anyone in future wonders what I did, here is how I solved it

I still had to override the login function inside LoginController.php this had to be done so I get all the throttling and error messages that can be generated by the system. Here is my final function

    public function login(Request $request)
    {
        $this->validateLogin($request);

        if ($this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

            return $this->sendLockoutResponse($request);
        }

        if(Auth::attempt(['email' => $request->email, 'password' => $request->password, 'is_activated' => 1])) {
            // return redirect()->intended('dashboard');
        }  else {
            $this->incrementLoginAttempts($request);
            return response()->json([
                'error' => 'This account is not activated.'
            ], 401);
        }

        $this->incrementLoginAttempts($request);
        return $this->sendFailedLoginResponse($request);
    }

@BishoyWagih if you think it could have been even more simplified plz let me know :)

nikocraft left a reply on How To Override Auth Login Function In Laravel? • 1 month ago

ok I see now, example is in the documentation. Thanks :)

nikocraft left a reply on How To Override Auth Login Function In Laravel? • 1 month ago

and how exactly do I tell attempt to also check the is_activated field

What would I put here inside attempt so it checks additional column for true or false?

        return $this->guard()->attempt(
            $this->credentials($request), $request->filled('remember')
        );

nikocraft left a reply on How To Override Auth Login Function In Laravel? • 1 month ago

You are correct I want to check for is_activated. I did this for now:

I copied the whole login function into LoginController.php and this is the interesting part

        if ($this->guard()->validate($this->credentials($request))) {
            $user = $this->guard()->getLastAttempted();
            if ($user->is_activated && $this->attemptLogin($request)) {
                return $this->sendLoginResponse($request);
            } else {
                $this->incrementLoginAttempts($request);
                if ($request->ajax()) {
                    return response()->json([
                        'error' => 'This account is not activated.'
                    ], 401);
                }
            }
        }

If I do it as you suggest, how can I also generate the error message as above only if is_activated is false on that particular user?

nikocraft started a new conversation How To Override Auth Login Function In Laravel? • 1 month ago

I need to override laravels default login function, however I am confused by the code I find there. I do not understand how laravel AuthenticatesUsers.php verifies that user exists in db and then authenticates the user.

I've come to this function in AuthenticatesUsers

    /**
     * Attempt to log the user into the application.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return bool
     */
    protected function attemptLogin(Request $request)
    {
        return $this->guard()->attempt(
            $this->credentials($request), $request->filled('remember')
        );
    }

I guess I would need to override this function inside auth/LoginController.php

but I do not understand how it works. Where are guard() and attempt() implemented, I guess the real action happens there. I need to add another condition to the login.

Anyone understands how laravels default login works? and those two functions guard() and attempt(), for example attempt is not implemented inside AuthenticatesUsers.php it self and I belive its this function I should really override.

Where can I find it's implementation?

4th June, 2018

nikocraft left a reply on Making A Laravel 5.4 Query On A JSON Field Containing A JSON Array • 2 months ago

I got a similar problem. Here is my case:

Inside users table I have a json column named "agencies" that stores data as a simple array like this:

[
"0eb2edf0-50cb-44ff-a0a6-b2a104a9dc12",
"f7c748d4-8718-441e-aa69-91b890ead5ed"
],

the above is valid json. When I try to select all users that contain 0eb2edf0-50cb-44ff-a0a6-b2a104a9dc12 I get null

Is my query correct?

$users = User::whereRaw('JSON_CONTAINS(agencies->"$[*]", "0eb2edf0-50cb-44ff-a0a6-b2a104a9dc12")')->get();

is the below correct way to do write JSON select query considering how I store uuids as an array inside agencies column which is defined as json?

'JSON_CONTAINS(agencies->"$[*]", "0eb2edf0-50cb-44ff-a0a6-b2a104a9dc12"

I looked at the original stackoverflow answer posted above and modified it to this agencies->"$[*]" but it does not seem to be working for me.

Using Laravel 5.4

I'd appreciate if you guys had any ideas what may be wrong in my case?

26th May, 2018

nikocraft started a new conversation Call Artisan Command That Has No Name For The One And Only Option • 2 months ago

How would I execute command like this from the Controller:

Package I am using that gives the below artisan commands: https://github.com/JosephSilber/page-cache

php artisan page-cache:clear {slug}

for example if typed manually

php artisan page-cache:clear about-us

Laravel docs gives us this: https://laravel.com/docs/5.6/artisan#programmatically-executing-commands

Artisan::call('email:send', [
    'user' => 1, '--queue' => 'default'
]);

Since the artisan command page-cache:clear does not take any named parameters, how do I send the slug parameter to it?

I've tried this:

Artisan::call('page-cache:clear ' . $content->slug);

and get back this error:

Command "page-cache:clear hem" is not defined.↵↵Did you mean this?↵    page-cache:clear

and also I've tried this:

Artisan::call('page-cache:clear', [$content->slug]);

but then slug is not added and it calles

php artisan page-cache:clear without slug so this package clears all the cached files.

23rd May, 2018

nikocraft left a reply on How To Go From Http To Https, Certificate Already Installed And Https Is Working... • 2 months ago

@cronix

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ / [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

I placed it at the end of .httaccess that comes with laravel but it gives an error:

The page isn’t redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

nikocraft left a reply on How To Go From Http To Https, Certificate Already Installed And Https Is Working... • 2 months ago

nice, but why layout.app, why not web.php where it would be more elegant to keep that code at top?

nikocraft started a new conversation How To Go From Http To Https, Certificate Already Installed And Https Is Working... • 2 months ago

if someone directly enters www.myapp.com the browser will take them to http://www.myapp.com

myapp is configured to work with https so if we enter manually https://www.myapp.com then there are no problems laravel generates https urls correctly?

how do I get browser to go to https when user just enters www.myapp.com instead of browser taking them to the http?

Where is the most elegant place to make this happen?

10th May, 2018

nikocraft left a reply on Will Laravels Packages Also Work On Lumen? • 3 months ago

sorry name of that package confused me, I thought it would execute on the client and not on server, actually link I post first is wrapper for the htmlpurifier! :)

nikocraft left a reply on Will Laravels Packages Also Work On Lumen? • 3 months ago

there is also a postman that hacker can use to post something to an endpoint :)

nikocraft started a new conversation Will Laravels Packages Also Work On Lumen? • 3 months ago

I'm interested in Purifier package which is used to clean up the input from the user, and wonder if I can use it on Lumen

https://github.com/mewebstudio/Purifier

What is everyone else using to sanitize input in Lumen?

5th May, 2018

nikocraft left a reply on How To Print Curly Braces From Database • 3 months ago

thats great! thanks for update :) we all use vuejs now in our projects and I will soon need this again, so its just purefect! :)

24th March, 2018

nikocraft left a reply on SQLSTATE[HY000]: General Error: 1215 Cannot Add Foreign Key Constraint Laravel • 4 months ago

@snapey you never had to do anything like this? for parent-child in the same table?

@cornix I figured out the problem, I had to add unique() to the id column, it wont assign it without that.

nikocraft started a new conversation SQLSTATE[HY000]: General Error: 1215 Cannot Add Foreign Key Constraint Laravel • 4 months ago

I am trying to make a foreign key in the same table and no matter what I test I get an error.

This is my code

        Schema::create('trip_tags', function (Blueprint $table) {
            $table->uuid('uuid')->unique();
            $table->integer('id')->unsigned();
            $table->string('name')->nullable();
            $table->integer('parent')->unsigned()->nullable();

            $table->timestamps();
        });

        Schema::table('trip_tags', function (Blueprint $table) {

            $table->foreign('parent')
                ->references('id')
                ->on('trip_tags')
                ->onDelete('cascade');
        });

I try to point parent to id, both are unsigned integers, I guess the reason that creating the foreign key fails is that they are not compatible in some way, I cant figure out what is wrong.

I tried to point parent to uuid but then had to make it a string and that worked. But I have to have the parent point to id which is integer and I cant get it to migrate withour error.

5th March, 2018

nikocraft left a reply on Remove Cache By Asterix • 5 months ago

hi @lostdreamer_nl

thanks for the help, I am using file driver, thats not a bad idea.

I am aware of separation of logic and rendering etc, however there exist cases when you have to to some stuff that is against the norm.

I am building a cms that has themes, themes that can be built by other authors then my self, themes can have locations for the menu, for example primary, secondary, footer, whatever.

Since I in the forhand do not know if they will even support a particular location and locations names are up to theme author I can't in the controller do the selection of the menu and menu items. I have to do it from views, and the code above is actually not in the view eitherm, its in a component, component may technically be a view, but components in my opnion should be able to have some logic in them, specially if you can't put that logic in Controller.

4th March, 2018

nikocraft started a new conversation Remove Cache By Asterix • 5 months ago

Hi

I create cache like this:

        @foreach ($menu->items as $key => $item)
            <div class="{{ $itemclass or 'menu-item'}}">
                @switch($item->type)
                    @case("CustomUrlItem")
                        <a href="{{ $item->meta }}">{{ $item->title }}</a>
                    @break

                    @case("PageItem")
                        @php
                            $page = Cache::rememberForever('menu-item-'.$item->meta, function() use($item) {
                                return Content::find($item->meta);
                            });
                        @endphp
                        <a href="{{ $page->slug }}">{{ $item->title }}</a>
                    @break

                @endswitch
            </div>
        @endforeach

if we focus specifically on this part:

                    @case("PageItem")
                        @php
                            $page = Cache::rememberForever('menu-item-'.$item->meta, function() use($item) {
                                return Content::find($item->meta);
                            });
                        @endphp
                        <a href="{{ $page->slug }}">{{ $item->title }}</a>
                    @break

When I want to remove cache for all 'menu-item-*' how could I do that.

Right now if I want to remove cache for menu-item-*

Cache::forget('menu-item-1');
Cache::forget('menu-item-2');
Cache::forget('menu-item-3');

I would have to iterate through all of menu-item-1, menu-item-2 etc to remove them? Could I do something like this instead:

Cache::forget('menu-item-*');

And that would wipe out all of menu-item-* cache?

3rd March, 2018

nikocraft left a reply on Precedence Of App.php Service Providers Vs Autoloaded Service Providers • 5 months ago

true! I just upgraded to 5.5 and then to 5.6 and found out about dont-discover, however this seemed to work

    Igaster\LaravelTheme\themeServiceProvider::class,
    App\Providers\MyServiceProvider::class,

so I did not have to disable autodiscover for LaravelTheme package...

2nd March, 2018

nikocraft started a new conversation Precedence Of App.php Service Providers Vs Autoloaded Service Providers • 5 months ago

Hi

I am upgrading my app from 5.4 to 5.5 in 5.5 we have autoloaded SPs and since I am using a package that has to have a preceedance over my own SP which needs to load after this package and add some stuff to it.

I wonder how does Larave 5.5 handle preceedance with autoloaded SPs vs SPs in app.php

for example in 5.4 app.php I have this

    Igaster\LaravelTheme\themeServiceProvider::class,
    App\Providers\MyThemesServiceProvider::class,

now that I update to 5.5 Igaster/laravel-theme is autodiscovered so I do not need to add it to app.php

If I remove: Igaster\LaravelTheme\themeServiceProvider::class from app.php in 5.5

will I run into any problems with this line in app.php

App\Providers\MyThemesServiceProvider::class

and MyThemesServiceProvider not being able to find Igaster\LaravelTheme\themeServiceProvider

Greatfull for any insights from the community!

1st March, 2018

nikocraft started a new conversation I Run Composer Update On 5.5 After Adding Some Packages In Composer.json Got Problem With That... • 5 months ago

I run composer update and got this output:

Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for tightenco/ziggy ^0.6.2 -> satisfiable by tightenco/ziggy[v0.6.2].
    - Conclusion: remove laravel/framework v5.5.36
    - Conclusion: don't install laravel/framework v5.5.36
    - Conclusion: don't install laravel/framework v5.5.35
    - Conclusion: don't install laravel/framework v5.5.34
    - Conclusion: don't install laravel/framework v5.5.33
    - Conclusion: don't install laravel/framework v5.5.32
    - Conclusion: don't install laravel/framework v5.5.31
    - Conclusion: don't install laravel/framework v5.5.30
    - Conclusion: don't install laravel/framework v5.5.29
    - Conclusion: don't install laravel/framework v5.5.28
    - Conclusion: don't install laravel/framework v5.5.27
    - Conclusion: don't install laravel/framework v5.5.26
    - Conclusion: don't install laravel/framework v5.5.25
    - Conclusion: don't install laravel/framework v5.5.24
    - Conclusion: don't install laravel/framework v5.5.23
    - Conclusion: don't install laravel/framework v5.5.22
    - Conclusion: don't install laravel/framework v5.5.21
    - Conclusion: don't install laravel/framework v5.5.20
    - Conclusion: don't install laravel/framework v5.5.19
    - Conclusion: don't install laravel/framework v5.5.18
    - Conclusion: don't install laravel/framework v5.5.17
    - Conclusion: don't install laravel/framework v5.5.16
    - Conclusion: don't install laravel/framework v5.5.15
    - Conclusion: don't install laravel/framework v5.5.14
    - Conclusion: don't install laravel/framework v5.5.13
    - Conclusion: don't install laravel/framework v5.5.12
    - Conclusion: don't install laravel/framework v5.5.11
    - Conclusion: don't install laravel/framework v5.5.10
    - Conclusion: don't install laravel/framework v5.5.9
    - Conclusion: don't install laravel/framework v5.5.8
    - Conclusion: don't install laravel/framework v5.5.7
    - Conclusion: don't install laravel/framework v5.5.6
    - Conclusion: don't install laravel/framework v5.5.5
    - Conclusion: don't install laravel/framework v5.5.4
    - Conclusion: don't install laravel/framework v5.5.3
    - Installation request for graham-campbell/markdown ^7.1 -> satisfiable by graham-campbell/markdown[v7.1.0].
    - Conclusion: don't install laravel/framework v5.5.2
   - graham-campbell/markdown v7.1.0 requires illuminate/view 5.1.*|5.2.*|5.3.*|5.4.* -> satisfiable by illuminate/view[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1.8, v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.23, v5.3.4, v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9].
    - don't install illuminate/view v5.1.1|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.1.13|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.1.16|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.1.2|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.1.20|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.1.22|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.1.25|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.1.28|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.1.30|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.1.31|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.1.41|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.1.6|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.1.8|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.0|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.19|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.21|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.24|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.25|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.26|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.27|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.28|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.31|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.32|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.37|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.43|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.45|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.6|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.2.7|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.3.0|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.3.16|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.3.23|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.3.4|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.4.0|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.4.13|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.4.17|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.4.19|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.4.27|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.4.36|don't install laravel/framework v5.5.0
    - don't install illuminate/view v5.4.9|don't install laravel/framework v5.5.0
    - tightenco/ziggy v0.6.2 requires laravel/framework ^5.4.29 -> satisfiable by laravel/framework[v5.5.36, v5.5.0, v5.5.1, v5.5.10, v5.5.11, v5.5.12, v5.5.13, v5.5.14, v5.5.15, v5.5.16, v5.5.17, v5.5.18, v5.5.19, v5.5.2, v5.5.20, v5.5.21, v5.5.22, v5.5.23, v5.5.24, v5.5.25, v5.5.26, v5.5.27, v5.5.28, v5.5.29, v5.5.3, v5.5.30, v5.5.31, v5.5.32, v5.5.33, v5.5.34, v5.5.35, v5.5.4, v5.5.5, v5.5.6, v5.5.7, v5.5.8, v5.5.9].
    - Conclusion: don't install laravel/framework v5.5.1


Does anyone have any idea what went wrong here? my require looks like this:

    "require": {
        "php": ">=7.0.0",
        "fideloper/proxy": "~3.3",
        "laravel/framework": "5.5.*",
        "laravel/tinker": "~1.0",
        "barryvdh/laravel-debugbar": "^2.4",
        "caffeinated/modules": "^4.0",
        "camroncade/timezone": "^0.1.0",
        "doctrine/dbal": "^2.5",
        "graham-campbell/markdown": "^7.1",
        "igaster/laravel-theme": "dev-master",
        "intervention/image": "^2.4",
        "mews/purifier": "^2.0",
        "santigarcor/laratrust": "3.2.*",
        "tightenco/ziggy": "^0.6.2"
    },

nikocraft left a reply on Do I Need To Include Doctrine/dbal In Composer For Laravel 5.5 And Above? • 5 months ago

No I do not have such migrations yet, since project is not yet released and I can refactor it as I see fit, no need to create migrations for modifications of columns right now. Thanks for really quick response, much obliged! :)

nikocraft left a reply on Do I Need To Include Doctrine/dbal In Composer For Laravel 5.5 And Above? • 5 months ago

Hi @sutherland

should I add it again? Lets say I need to modify existing columns using a migration, then I need this package or is it autoincluded in 5.5 and above?

nikocraft started a new conversation Do I Need To Include Doctrine/dbal In Composer For Laravel 5.5 And Above? • 5 months ago

I am looking to upgrade my app from laravel 5.4 to laravel 5.5, I just intalled new laravel app based on 5.5 and opened composer and comparing to my existing app composer I just found this

    "require": {
        "php": ">=7.0.0",
        "fideloper/proxy": "~3.3",
        "laravel/framework": "5.5.*",
        "laravel/tinker": "~1.0"
    },

while in my 5.4 app I found that I had inside require among other things:

      "doctrine/dbal": "^2.5",

Do I need to include this manually in fresh laravel 5.5 app or is it not required? I'm not sure why I have it in 5.4, maybe it was required for that version?

nikocraft started a new conversation Blade HasSection, What Is It Really? • 5 months ago

Hi

Could someone explain to me what hasSection is and how it works?

I have read this: https://laravel.com/docs/5.6/blade

You may check if a section has content using the @hasSection directive:

But I do not understand, what does hasSection actually do to check if there is some content in section or not? For example:

@hasSection('navigation')
    <div class="pull-right">
        @yield('navigation')
    </div>

    <div class="clearfix"></div>
@endif

What happens here? Where does 'navigation' inside hasSection come from? Is it a model from db, if not then what is it and where it does get initiated?

Thanks in advance...

nikocraft left a reply on Casting To Boolean • 5 months ago

yes @richardh that is the correct way to deal with it...

28th February, 2018

nikocraft left a reply on How Do I Query By Geolocation In Laravel 5? • 5 months ago

@sean.tilley good solution, thanks for updating us all

12th February, 2018

nikocraft left a reply on I Can't Update Php Package I Forked Recently, I Was Able To Do That Week Ago But Not Anymore, Need Help • 6 months ago

just this:

    "require": {
        "illuminate/contracts": "5.4.*|5.5.*"
    },
    "require-dev": {
        "orchestra/testbench": "~3.4",
        "phpunit/phpunit": "^6.0"
    },

nikocraft started a new conversation I Can't Update Php Package I Forked Recently, I Was Able To Do That Week Ago But Not Anymore, Need Help • 6 months ago

I forked a php package and am using forked version in my local machine, I plan to extend the package, while I was working with it a week ago everything was working fine, today when I focused on this part of the application and tried to update the package like

composer update author/package-name

and I also have this part in the composer.json

"repositories": [ { "type": "vcs", "url": "https://github.com/myproject/package-name" } ], I suddenly get this:

Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

Problem 1

symfony/event-dispatcher v4.0.3 requires php ^7.1.3 -> your PHP version (7.1.1) does not satisfy that requirement.

symfony/event-dispatcher v4.0.3 requires php ^7.1.3 -> your PHP version (7.1.1) does not satisfy that requirement.

Installation request for symfony/event-dispatcher (locked at v4.0.3) -> satisfiable by symfony/event-dispatcher[v4.0.3].

I currently have php 7.1.1 installed, I wonder why after a week or so where I was able to run the command above without a problem today I can't and what is also confusing me is this

https://lumen.laravel.com/docs/5.4#server-requirements

php requirement for laravel on the server is 5.6.4 or higher.

So why would symfony/event-dispatcher require 7.1.3 and why would laravel's own page claim version 5.4 min-requirment is php 5.6.4?

Anyone has any clues?

21st October, 2017

nikocraft started a new conversation Passing Arguments To Custom Directive • 9 months ago

I'm having problems passing arguments to custom directive I wrote:

this is what I pass: @renderblocks($deviceType, $subBlocksIds, $allBlocks)

first is just a string, second array of numbers and third an Eloquent array of models.

When I try to use the parameters well then I run into a problem:

    Blade::directive('renderblocks', function ($expression) {
        list($deviceType, $subBlocksIds, $allBlocks) = explode(', ', $expression);
        dd($deviceType);

it prints this -> "$deviceType" just like that and not actual string that the variable is holding. Same for other parameters, how can I pass parameters to custom blade directive and use them inside?

20th September, 2017

nikocraft left a reply on Class 'CreateContentTemplateBlocksTable' Not Found • 11 months ago

yeah I did that, but did not rename the file and needed to do that as well :)

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.