hjortur17

Hire Me

Experience

9,020

0 Best Reply Awards

  • Member Since 11 Months Ago
  • 70 Lessons Completed
  • 2 Favorites

23rd October, 2018

hjortur17 left a reply on Unable To Deploy To Server • 3 hours ago

Yes

hjortur17 left a reply on Unable To Deploy To Server • 3 hours ago

What do you mean?

hjortur17 left a reply on Unable To Deploy To Server • 3 hours ago

I can upload it, no problem, but still, Laravel Forge says We were unable to deploy to server

hjortur17 left a reply on Unable To Deploy To Server • 3 hours ago

This what I get:

Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory)

modified:   public/css/app.css
modified:   public/js/app.js

no changes added to commit (use "git add" and/or "git commit -a")

hjortur17 left a reply on Unable To Deploy To Server • 3 hours ago

Nope, only one branch

hjortur17 left a reply on Unable To Deploy To Server • 3 hours ago

On branch master Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

hjortur17 left a reply on Unable To Deploy To Server • 3 hours ago

I get this when I commit:

On branch master Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

hjortur17 left a reply on Unable To Deploy To Server • 3 hours ago

Done that, I do always do:

git add . git commit -m "message" git push

hjortur17 started a new conversation Unable To Deploy To Server • 3 hours ago

Hi, so I'm uploading my files to GitHub and Laravel Forge picks that up and works with it to display my website. But for some reasons, Laravel Forge is Unable to deploy to server, and when I try to git push, it says Already up to date. Does the same when I try to git pull. Can anyone help me with this one?

Here is the error message from the Laravel Forge dashboard:

Tue Oct 23 14:09:56 UTC 2018
From github.com:hjortur17/nfs
 * branch            master     -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
    package-lock.json
    package.json
    public/css/app.css
    public/js/app.js
    resources/js/bootstrap.js
Please, commit your changes or stash them before you can merge.
Aborting
Updating 90d1692..325c61b

Thanks again!

hjortur17 left a reply on Just Published My Laravel Project And Vue Is Not Working • 3 hours ago

Just needed to run npm install

hjortur17 started a new conversation Just Published My Laravel Project And Vue Is Not Working • 4 hours ago

Hi, I just published my Laravel project (nfs.is) and everything works except Vue. It's just printing out the tag for the component, not the template which is in it. Please help!

The error from Safari:

[Error] [Vue warn]: Unknown custom element: <avatar-form> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

22nd October, 2018

hjortur17 left a reply on Vue Is Not Defined • 21 hours ago

Figured that out! Thank you. I need this in my file:

window.App = {!! json_encode([ 'csrfToken' => csrf_token(), 'user' => Auth::user(), 'signedIn' => Auth::check() ]) !!};

hjortur17 left a reply on Vue Is Not Defined • 22 hours ago

Yes like this, with Laravel Blade

{{ $profileUser->name }}

{{ '@' . $profileUser->username }}

hjortur17 left a reply on Vue Is Not Defined • 22 hours ago

@D9705996 Could you help me with something? I'm trying to create the autherize function but I'm getting a error when trying to use user.

Here is the error message from chrome:

[Vue warn]: Error in render: "TypeError: Cannot read property 'user' of undefined" found in

---> at resources/js/components/AvatarForm.vue

Here is how the AvatarForm.vue file looks like:

            <form v-if="canUpdate" method="POST" enctype="multipart/form-data">
                <div class="file">
                    <label class="file-label">
                        <input class="file-input" type="file" name="avatar">
                        <span class="file-cta">
                            <span class="file-icon">
                                <i class="fas fa-upload"></i>
                            </span>
                            <span class="file-label">
                                Choose a file…
                            </span>
                        </span>
                    </label>
                </div>

                <button type="submit">Senda inn</button>
            </form>
        </div>
    </div>
    <p class="m10t">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </p>
</div>

export default { props: ['user'],
    data() {
        return {
            avatar: ''
        }
    },

    computed: {
        canUpdate() {
            return this.authorize(user => user.id === this.user.id)
        }
    }
}

hjortur17 left a reply on Vue Is Not Defined • 22 hours ago

That worked! Thank you!

hjortur17 left a reply on Vue Is Not Defined • 23 hours ago

Thanks! @D9705996 that got the terminal start running, but still chrome is giving my the same error message

app.js:24924 Uncaught ReferenceError: vue is not defined at Object.VERSION (app.js:24924) at webpack_require (app.js:20) at Object. (app.js:24862) at webpack_require (app.js:20) at Object. (app.js:24847) at webpack_require (app.js:20) at app.js:63 at app.js:66

hjortur17 started a new conversation Vue Is Not Defined • 23 hours ago

Hi, I'm trying to use Vue with my Laravel application. But I get a error message.

This is the error message from terminal:

95% emitting                                                                      

 ERROR  Failed to compile with 1 errors                                                                                                18:28:03

 error  in ./resources/js/components/AvatarForm.vue

(Emitted value instead of an instance of Error) 
  Error compiling template:
  
  <div class="floating-image-box">
    <div class="box">
        <img :src="avatar">
        
        <form v-if="canUpdate" method="POST" enctype="multipart/form-data">
            <div class="file">
                <label class="file-label">
                    <input class="file-input" type="file" name="avatar">
                    <span class="file-cta">
                        <span class="file-icon">
                            <i class="fas fa-upload"></i>
                        </span>
                        <span class="file-label">
                            Choose a file…
                        </span>
                    </span>
                </label>
            </div>
  
            <button type="submit">Senda inn</button>
        </form>
    </div>
  </div>
  <p class="m10t">
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  </p>
  
  - Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.


 @ ./resources/js/components/AvatarForm.vue 6:23-260
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

And this is from Chrome:

Uncaught ReferenceError: vue is not defined
        at Object.VERSION (app.js:24900)
        at __webpack_require__ (app.js:20)
        at Object.<anonymous> (app.js:24862)
        at __webpack_require__ (app.js:20)
        at Object.<anonymous> (app.js:24847)
        at __webpack_require__ (app.js:20)
        at app.js:63
        at app.js:66

I added this to my bootstrap.js file:

window.Vue = require('vue');

vue.prototype.authorize = function(handler) {
    let user = window.App.user;

    return user ? handler(user) : false;
}; 

This is my app.js file:

require('./bootstrap');

window.Vue = require('vue');

Vue.component('avatar-form', require('./components/AvatarForm.vue'));

const app = new Vue({
    el: '#app'
});

And this is my AvatarForm.vue file:

<template>
    <div class="floating-image-box">
        <div class="box">
            <img :src="avatar">
            
            <form v-if="canUpdate" method="POST" enctype="multipart/form-data">
                <div class="file">
                    <label class="file-label">
                        <input class="file-input" type="file" name="avatar">
                        <span class="file-cta">
                            <span class="file-icon">
                                <i class="fas fa-upload"></i>
                            </span>
                            <span class="file-label">
                                Choose a file…
                            </span>
                        </span>
                    </label>
                </div>

                <button type="submit">Senda inn</button>
            </form>
        </div>
    </div>
    <p class="m10t">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </p>
</template>

<script>
    export default {
        props: ['user'],

        data() {
            return {
                avatar: ''
            }
        },

        computed: {
            canUpdate() {
                return this.authorize(user => user.id === this.user.id)
            }
        }
    }
</script>

hjortur17 left a reply on UserPolicy • 1 day ago

@lostdreamer_nl I figured it out! Thanks for letting me know of the log file! I just needed to run composer update in my terminal!

hjortur17 left a reply on UserPolicy • 1 day ago

Okay, here you go:

[2018-10-22 15:28:04] local.ERROR: ReflectionFunction::__construct() expects parameter 1 to be string, array given (View: /Users/hjorturfreyrlarusson/website/nfs/resources/views/profiles/show.blade.php) {"exception":"[object] (ErrorException(code: 0): ReflectionFunction::__construct() expects parameter 1 to be string, array given (View: /Users/hjorturfreyrlarusson/website/nfs/resources/views/profiles/show.blade.php) at /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php:387, Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): ReflectionFunction::__construct() expects parameter 1 to be string, array given at /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php:387) [stacktrace] #0 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(47): Illuminate\View\Engines\CompilerEngine->handleViewException(Object(Symfony\Component\Debug\Exception\FatalThrowableError), 1) #1 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath('/Users/hjorturf...', Array) #2 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/View/View.php(142): Illuminate\View\Engines\CompilerEngine->get('/Users/hjorturf...', Array) #3 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/View/View.php(125): Illuminate\View\View->getContents() #4 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/View/View.php(90): Illuminate\View\View->renderContents() #5 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Http/Response.php(42): Illuminate\View\View->render() #6 /Users/hjorturfreyrlarusson/website/nfs/vendor/symfony/http-foundation/Response.php(202): Illuminate\Http\Response->setContent(Object(Illuminate\View\View)) #7 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Router.php(747): Symfony\Component\HttpFoundation\Response->__construct(Object(Illuminate\View\View)) #8 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Router.php(719): Illuminate\Routing\Router::toResponse(Object(Illuminate\Http\Request), Object(Illuminate\View\View)) #9 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Router.php(679): Illuminate\Routing\Router->prepareResponse(Object(Illuminate\Http\Request), Object(Illuminate\View\View)) #10 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #11 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #12 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure)) #13 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #14 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(75): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #15 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure)) #16 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #17 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #18 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure)) #19 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #20 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #21 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure)) #22 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #23 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #24 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure)) #25 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #26 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(66): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #27 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure)) #28 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #29 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #30 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #31 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Router.php(656): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request)) #32 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Router.php(622): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route)) #33 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Router.php(611): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request)) #34 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) #35 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request)) #36 /Users/hjorturfreyrlarusson/website/nfs/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(65): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #37 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle(Object(Illuminate\Http\Request), Object(Closure)) #38 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #39 /Users/hjorturfreyrlarusson/website/nfs/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #40 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure)) #41 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #42 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #43 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure)) #44 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #45 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #46 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure)) #47 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #48 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #49 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure)) #50 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #51 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #52 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure)) #53 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #54 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #55 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #56 /Users/hjorturfreyrlarusson/website/nfs/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request)) #57 /Users/hjorturfreyrlarusson/website/nfs/public/index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request)) #58 /Users/hjorturfreyrlarusson/.composer/vendor/laravel/valet/server.php(147): require('/Users/hjorturf...') #59 {main} "}

hjortur17 left a reply on UserPolicy • 1 day ago

Okay @lostdreamer_nl , what are you talking about the "Full stack trace from your log file?"

But here is my show.blade.php file

@extends ('layouts.profiles')

@section ('header')
    <section id="profile">
        <header id="profile-header" class="has-background-image" style="background-image: url('/css/img/nature.jpg');">
            <div id="icon-left-corner">
                <a href="/"><i class="fal fa-home"></i></a>
            </div>
            <div id="icon-right-corner">
                @if (Auth::id() === $profileUser->id)
                    <a title="Útskrá" href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit()">
                        <i class="fal fa-sign-out"></i>
                    </a>

                    <form id="logout-form" action="{{ route('logout') }}" method="POST">
                        @csrf
                    </form>
                @endif
            </div>
        </header>
        <div class="status-bar">
            <div class="container">
                <div class="columns">
                    <div class="column"></div>
                    <div class="column">
                        {{-- <div class="columns">
                            <div class="column has-text-centered">
                                <h4>Athugasemdir</h4>
                            </div>
                            <div class="column has-text-centered">
                                <h4>Fylgir</h4>
                            </div>
                            <div class="column has-text-centered">
                                <h4>Fylgendur</h4>
                            </div>
                            <div class="column has-text-centered">
                                <h4>Likes</h4>
                            </div>
                        </div> --}}
                    </div>
                    <div class="column">
                        @if (Auth::id() === $profileUser->id)
                            <a href="#" class="is-button is-right">Stillingar</a>
                        @endif
                        {{-- <a href="#" class="is-button is-right">Fylgja</a> --}}
                    </div>
                </div>
            </div>
        </div>
        <div class="container m5t">
            <div class="columns">
                <div class="column is-4">
                    <div class="floating-image-box">
                        <div class="box">
                            <img src="/css/img/profiles/default.png">
                            @can ('update', $profileUser)
                                ADD FORM HERE
                            @endcan
                        </div>
                    </div>
                    <p class="m10t">
                        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                    </p>
                </div>
                <div class="column">
                    <h1 class="section-title">{{ $profileUser->name }}</h1>
                    <p class="username">{{ '@' . $profileUser->username }}</p>
                </div>
            </div>
        </div>
    </section>
@endsection

hjortur17 started a new conversation UserPolicy • 1 day ago

Hi, i'm having trouble update-ing the signedInUser. Does anyone have idea why I'm getting this error message:

ReflectionFunction::__construct() expects parameter 1 to be string, array given (View: /Users/hjorturfreyrlarusson/website/nfs/resources/views/profiles/show.blade.php)

My UserPolicy looks like this:

/**
     * Determine whether the user can update the model.
     *
     * @param  \App\User  $user
     * @param  \App\User  $signedInUser
     * @return mixed
*/
public function update(User $user, User $signedInUser)
{
        return $signedInUser->id === $user->id;
}

My AuthServiceProvider looks like this:

protected $policies = [
        'App\Model' => 'App\Policies\ModelPolicy',
        'App\User' => 'App\Policies\UserPolicy',
];

My ProfilesController looks like this:

class ProfilesController extends Controller
{
    public function show(User $user)
    {
        return view('profiles.show', [
            'profileUser' => $user
        ]);
    }
}

My show.blade.php file looks like this:

@can ('update', $profileUser)
    ADD FORM HERE
@endcan

10th October, 2018

hjortur17 left a reply on Argument 1 Passed To App\Http\Controllers\RepliesController::store() Must Be An Instance Of App\Thread, String Given • 1 week ago

Found out the problem, forgot to the $channelId in the store method.

public function store($channelId, Thread $thread) { $thread->addReply([ 'body' => request('body'), 'user_id' => auth()->id() ]);

          return back();
}

hjortur17 left a reply on Argument 1 Passed To App\Http\Controllers\RepliesController::store() Must Be An Instance Of App\Thread, String Given • 1 week ago

So @Cronix you are saying that there is a problem with my routes?

9th October, 2018

hjortur17 left a reply on Argument 1 Passed To App\Http\Controllers\RepliesController::store() Must Be An Instance Of App\Thread, String Given • 1 week ago

Route::get('/frettir', '[email protected]')->name('threads'); // DISPLAYS ALL THREADS Route::get('/frettir/{channel}', '[email protected]'); // DISPLAYS ALL THREADS ASSOCIATED WITH A CHANNEL Route::get('/frettir/{channel}/{thread}', '[email protected]'); // SHOW A THREAD Route::post('/frettir/{channel}/{thread}/athugasemdir', '[email protected]'); // SHOW A THREAD

hjortur17 started a new conversation Argument 1 Passed To App\Http\Controllers\RepliesController::store() Must Be An Instance Of App\Thread, String Given • 1 week ago

Hi, I'm trying to build a reply system into my Laravel application but I got an error.

Argument 1 passed to App\Http\Controllers\RepliesController::store() must be an instance of App\Thread, string given

Here is my code:

Form

<form method="POST" action="{{ $thread->path() . '/athugasemdir' }}">
            @csrf

            <div class="field">
                <textarea class="textarea" name="reply" rows="4" style="resize: none;"></textarea>
            </div>
            <div class="field has-text-right">
                <button class="is-button" type="submit" style="text-transform: uppercase;">Birta</button>
            </div>
        </form>

RepliesController

public function store(Thread $thread)
    {
              $thread->addReply([
                     'body' => request('body'),
                     'user_id' => auth()->id()
              ]);

              return back();
    }

Thread.php

public function replies()
    {
        return $this->hasMany(Reply::class)->orderBy('created_at', 'desc');
    }

    public function addReply($reply)
    {
        $this->replies()->create($reply);
    }

Reply.php

protected $guarded = [];
    
    public function owner()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

30th September, 2018

hjortur17 left a reply on Foreach Printing Twice The Same Content • 3 weeks ago

I just removed one of the divs "tile is-child box"

hjortur17 started a new conversation Foreach Printing Twice The Same Content • 3 weeks ago

Hi, I'm having trouble with my foreach loop. The loop print's every thread twice!

The Controller: ´´´ public function index() { $popular_threads = Thread::latest()->take(3)->get(); $threads = Thread::latest()->take(3)->get();

    return view('posts.index', compact('threads', 'popular_threads'));
}

´´´

The Blade file: ´´´

{{ $threads->first()->title}}

{{ $threads->first()->body }}

@foreach ($threads as $thread) @if (!$loop->first)

{{ $thread->title }}

{{ $thread->body }}

{{ $thread->title }}

{{ $thread->body }}

@endif @endforeach ´´´

23rd September, 2018

hjortur17 left a reply on Guests_may_not_create_threads • 4 weeks ago

Thanks! ?

hjortur17 left a reply on Guests_may_not_create_threads • 4 weeks ago

Yeah

Routes

Route::get('/frettir', '[email protected]'); 
Route::post('/frettir', '[email protected]');
Route::get('/frettir/{thread}', '[email protected]'); 
Route::post('/frettir/{thread}/athugasemdir', '[email protected]'); 

Controller

public function index()
       {
              $threads = Thread::latest()->get();
              
              return view('threads.index', compact('threads'));
       }

public function store(Request $request)
       {
              $thread = Thread::create([
                     'title' => request('title'),
                     'body' => request('body'),
                     'user_id' => auth()->id()
              ]);

              return redirect($thread->path());
       }

public function show(Thread $thread)
       {
              return view('threads.show', compact('thread'));
       }

User Model

    protected $fillable = [
        'name', 'email', 'password',
    ];

    protected $hidden = [
        'password', 'remember_token',
    ];

Thread Model

    protected $guarded = [];
    
    public function path()
    {
        return '/frettir/' . $this->id;
    }

    public function replies()
    {
        return $this->hasMany(Reply::class);
    }

    public function addReply($reply)
    {
        $this->replies()->create($reply);
    }

    public function creator()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

hjortur17 left a reply on Guests_may_not_create_threads • 4 weeks ago

Not sure, I just followed one of the tutorials. I'm just learning how to use the Test.

But now I'm getting another error.

Illuminate\Database\QueryException: SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: threads.user_id

hjortur17 started a new conversation Guests_may_not_create_threads • 4 weeks ago

Hi, I'm having trouble getting me tests to run. It always respond with this:

Failed asserting that exception of type "Illuminate\Database\QueryException" matches expected exception "Illuminate\Auth\AuthenticationException". Message was: "SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: threads.user_id

And this is my code:


/** @test */
    function guests_may_not_create_threads()
    {
        $this->expectException('Illuminate\Auth\AuthenticationException');

        $thread = factory('App\Thread')->make();

        $this->post('/frettir', $thread->toArray());
    }

22nd August, 2018

hjortur17 left a reply on Can't Write Image Data To Path • 2 months ago

This was suppost to be like this:

$filename = time() . '.' . $image->getClientOriginalExtension();

hjortur17 started a new conversation Can't Write Image Data To Path • 2 months ago

Hi, I'm trying to store images to the public folder, but it's telling me that I can't write image data to path. Please help! Here is my code:

if (request()->hasFile('image')) {
                     $image = request()->file('image');
                     $filename = time() . '.' . $image;
                     $path = public_path('images/' . $filename);

                     // if (!file_exists($path)) {
                     //        mkdir($path, 666, true);
                     // }

                     Image::make($image)->resize(128, 128)->encode('jpg', 75)->save($path);

                     Election::create([
                            'image' => $filename
                     ]);
              }
                        

I have tried to do chmod -R 777 public/images/ but that doesn't work

21st August, 2018

hjortur17 left a reply on Not Same Content On My Server And My Local Site • 2 months ago

Thanks, guys. I was pushing to the wrong branch

hjortur17 left a reply on Not Same Content On My Server And My Local Site • 2 months ago

And it's not in .gitignore file

hjortur17 left a reply on Not Same Content On My Server And My Local Site • 2 months ago

Texts and some lines in app.scss

hjortur17 started a new conversation Not Same Content On My Server And My Local Site • 2 months ago

Hi, I'm using Laravel Forge to upload my laravel project and when I push to Github the site changes. But I noticed that some content isn't the same online and on my local site. I've tried to push but GitHub says "Nothing to commit"

Any ideas how to fix this?

26th June, 2018

hjortur17 left a reply on Database Connections Error • 3 months ago

Thanks, that worked!

hjortur17 started a new conversation Database Connections Error • 3 months ago

Hi, so I'm trying to get data from my database but I'm getting the error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'portfolio.case_studies' doesn't exist (SQL: select * from case_studies order by created_at desc)

Here is my code:

HomeController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\CaseStudies;

class HomeController extends Controller
{
    public function index()
    {
        $cases = CaseStudies::latest()->get();

        return view('posts.index', compact('cases'));
    }
}

CreateCaseStudieTable

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class CaseStudies extends Model
{
    protected $guarded = [];

    public function path()
    {
         return '/case-studies/' . $this->id;
    }
}

CaseStudies.php

public function up()
    {
        Schema::create('case_studie', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->text('description');
            $table->timestamps();
        });
    }

hjortur17 left a reply on Laravel And Vue • 3 months ago

So I'm trying to use this component: https://www.npmjs.com/package/vue-float-label

9th June, 2018

hjortur17 started a new conversation Laravel And Vue • 4 months ago

I'm getting an error when trying to use Vue with Laravel.

RangeError: Maximum call stack size exceeded.
    get — app.js:39067
    Watcher — app.js:39051
    mountComponent — app.js:38715
    _init — app.js:40560
    Vue — app.js:40649
    (anonymous function) — app.js:13889
    __webpack_require__ — app.js:20
    (anonymous function) — app.js:13869
    __webpack_require__ — app.js:20
    (anonymous function) — app.js:63
    Global Code — app.js:64
    http://portfolio.test/js/bootstrap.js.map

You can see my code here:

require('./bootstrap');
window.Vue = require('vue');

import VueFloatLabel from 'vue-float-label'
Vue.use(VueFloatLabel)

Vue.component('float-label', require('./components/FloatLabelComponent.vue'));

const app = new Vue({
    el: '#app'
});
<template>
       <float-label>

       </float-label>
</template>

<script>
       import FloatLabel from 'vue-float-label/components/FloatLabel';

       export default {
              components: {
                     FloatLabel
              }
       }
</script>
<body>
    <div id="app">
        @yield ('header')

        @yield ('section1')

        @include ('partials.contact')
    </div>

    <script src="/js/app.js"></script>
</body>

30th May, 2018

hjortur17 left a reply on Mailtrap.io Error • 4 months ago

Still getting the error message

hjortur17 started a new conversation Mailtrap.io Error • 4 months ago

I'm trying to receive emails to the mailtrap inbox but I'm getting an error message.

The error message is:

Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required "

and my env file is like this:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=***
MAIL_PASSWORD=***

***I have an username and password in the fields

29th May, 2018

hjortur17 started a new conversation Sending Mail Error • 4 months ago

I'm getting the error: Undefined variable: data

Any ideas? I'm going to leave my code here:

public function index(Request $request)
    {
        $request->validate([
            'name' => 'required',
            'email' => 'required|email',
            'subject' => 'required|max:255',
            'message' => 'required|min:10'
        ]);

        $data = array(
            'name' => $request->name,
            'email' => $request->email,
            'website' => $request->website,
            'subject' => $request->subject,
            'bodyMessage' => $request->message
        );

        Mail::send('emails.contact', $data, function ($message) {
            $message->from($data['email'], $data['name']);
            $message->to('[email protected]', 'Hjörtur Freyr');

            $message->subject($data['subject']);
        });

        return redirect('/');
    }

27th May, 2018

hjortur17 left a reply on Laravel And Vue Error • 4 months ago

Thanks @ejdelmonico for your help!

hjortur17 left a reply on Laravel And Vue Error • 4 months ago

I got it to work! I had to add @ in front of {{message}}

26th May, 2018

hjortur17 left a reply on Laravel And Vue Error • 4 months ago

<title>Hjörtur Freyr - Web Developer</title>

{{-- STYLESHEET --}}
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<script defer src="https://pro.fontawesome.com/releases/v5.0.13/js/all.js" integrity="sha384-d84LGg2pm9KhR4mCAs3N29GQ4OYNy+K+FBHX8WhimHpPm86c839++MDABegrZ3gn" crossorigin="anonymous"></script>

{{-- @include ('partials.navbar')
    @yield ('header')

    @yield ('content1')

    @yield ('content2')

    @include ('partials.contact')

    @include ('partials.footer') --}}

    {{ message }}
</div>

<script src="{{ asset('js/app.js') }}"></script>

Just added these lines but nothing changed

hjortur17 left a reply on Laravel And Vue Error • 4 months ago

I have another product and using VUE there and it's no problem

hjortur17 left a reply on Laravel And Vue Error • 4 months ago

Valet

hjortur17 left a reply on Laravel And Vue Error • 4 months ago

Done that, doesn't work...

Edit Your Profile
Update

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