hjortur17

Hire Me

Experience

6,490

0 Best Reply Awards

  • Member Since 9 Months Ago
  • 53 Lessons Completed
  • 0 Favorites

26th June, 2018

hjortur17 left a reply on Database Connections Error • 1 month ago

Thanks, that worked!

hjortur17 started a new conversation Database Connections Error • 1 month 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 • 1 month 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 • 2 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 • 2 months ago

Still getting the error message

hjortur17 started a new conversation Mailtrap.io Error • 2 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 • 2 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 • 2 months ago

Thanks @ejdelmonico for your help!

hjortur17 left a reply on Laravel And Vue Error • 2 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 • 2 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 • 2 months ago

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

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

Valet

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

Done that, doesn't work...

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

And Vue is still not detected be Chrome

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

Yes

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

Now I get

Use of undefined constant message - assumed 'message' (this will throw an Error in a future version of PHP) (View: /Users//websites/portfolio/resources/views/layouts/master.blade.php) (View: /Users//websites/portfolio/resources/views/layouts/master.blade.php)

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

And the error message is:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)          portfolio.test/

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

So I'm using this extension on Chrome but it says that Vue is not detected.

I'm trying to bug fix Vue JS be simple to print out and Hello World message and I have my script tag in the bottom of my master.blade.php layout file and then a div#app over that

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

What do you mean?

hjortur17 started a new conversation Laravel And Vue Error • 2 months ago

Hi, I was starting a new product and trying to use VueJS but it gives me the error

''' Failed to load resource: the server responded with a status of 500 (Internal Server Error) '''

I'm trying to echo out message from app.js

/**

  • First we will load all of this project's JavaScript dependencies which
  • includes Vue and other libraries. It is a great starting point when
  • building robust, powerful web applications using Vue and Laravel. */

require('./bootstrap');

window.Vue = require('vue');

/**

  • Next, we will create a fresh Vue application instance and attach it to
  • the page. Then, you may begin adding components to this application
  • or customize the JavaScript scaffolding to fit your unique needs. */

Vue.component('example-component', require('./components/ExampleComponent.vue'));

const app = new Vue({ el: '#app' data: { message: 'Hello World' } });

@include ('partials.navbar')

    @yield ('header')

    @yield ('content1')

    @yield ('content2')

    @include ('partials.contact')

    @include ('partials.footer')

    {{ message }}
</div>

25th April, 2018

hjortur17 left a reply on Delete Function Not Working • 3 months ago

I got it to work. Thanks for the help!

This was happening because I have all of this inside of a table. I had to move the form inside tag (It was at the bottom of the table)

Thanks again for all the help and suggestion!

24th April, 2018

hjortur17 left a reply on Delete Function Not Working • 3 months ago

Okay, so I added the button and it didn't work. I did debug it with onClick function and just print out in the console and that worked.

I also tried to make hidden input but that didn't work either

And I don't know about any Javascript files how is interacting with this site.

I also forgot to mention this delete method worked before ...

hjortur17 left a reply on Delete Function Not Working • 3 months ago

I changed that to

return redirect('/stjornbord/frettir');

hjortur17 left a reply on Delete Function Not Working • 3 months ago

Just returning an error

hjortur17 left a reply on Delete Function Not Working • 3 months ago

5.6.16

hjortur17 left a reply on Delete Function Not Working • 3 months ago

Still getting the same error

hjortur17 left a reply on Delete Function Not Working • 3 months ago

The DD worked (I did dd($thread) same as @devk suggested), and the result was:

#attributes: array:8 [▼
    "id" => 2
    "slug" => "Title 2"
    "user_id" => 1
    "title" => "Title 2"
    "body" => "https://nfs.test/stjornbord/frettir/eyda/1aas ads asd"
    "image" => "frettir/yeIIaCv1f9azslcsYwSDjnLVCGtu1Zb4kQsXG7gs.jpeg"
    "created_at" => "2018-04-24 08:59:59"
    "updated_at" => "2018-04-24 08:59:59"
  ]

hjortur17 left a reply on Delete Function Not Working • 3 months ago

Nope the buttons did not work (When clicked nothing happend)

hjortur17 left a reply on Delete Function Not Working • 3 months ago

@rin4ik didn't work :/

hjortur17 left a reply on Delete Function Not Working • 3 months ago

@devk this is the outcome:

| DELETE | stjornbord/frettir/eyda/{thread} | thread.delete | Closure | web

hjortur17 left a reply on Delete Function Not Working • 3 months ago

I tried @rin4ik idea about making function inside web.php but that did work

It will not display ok

hjortur17 left a reply on Delete Function Not Working • 3 months ago

The URL is /stjornbord/frettir/eyda/1 the ID of the thread

hjortur17 left a reply on Delete Function Not Working • 3 months ago

Route::delete('/stjornbord/frettir/eyda/{thread}', '[email protected]')->name('thread.delete');

hjortur17 left a reply on Delete Function Not Working • 3 months ago

Done, sorry about that

hjortur17 started a new conversation Delete Function Not Working • 3 months ago

Hi, I'm trying to delete thread with onClick function. But I get MethodNotAllowedHttpException error

My code is:

@csrf @method('DELETE')

And the controller looks like this:

public function destroy(Thread $thread) { $thread->delete(); return back(); }

14th April, 2018

hjortur17 left a reply on Failed To Deploy Because Of The Composer.lock File • 4 months ago

No local changes to save - why? I was make-ing changes to my controller

git add . git commit -m "More readable controller" git stash push

No local changes to save

hjortur17 left a reply on Failed To Deploy Because Of The Composer.lock File • 4 months ago

How does git stash works? Should I do git add . git commit git stash or?

hjortur17 started a new conversation Failed To Deploy Because Of The Composer.lock File • 4 months ago

Hi, I recently updated to Laravel 5.6 and when I push to GitHub the change go thru but Forge always come's up with an error

From github.com:Hjortur17/nfs

  • branch master -> FETCH_HEAD error: Your local changes to the following files would be overwritten by merge: composer.lock Please, commit your changes or stash them before you can merge. Aborting Updating 3376a21..ceece9e

11th April, 2018

hjortur17 left a reply on Upgrade-ing To Laravel 5.6 • 4 months ago

It did to restart it

hjortur17 left a reply on Upgrade-ing To Laravel 5.6 • 4 months ago

Thanks

hjortur17 left a reply on Upgrade-ing To Laravel 5.6 • 4 months ago

No, when I try to use valet now to view my project it only displays h1 with the text: It works! and not the content from me.

Any ideas why that is?

So my project is inside of a folder called: websites I did valet park and then I did go to my project called nfs and did valet link and if I visit nfs.test it displays It works!

@rin4ik Any ideas why? Btw thank you very much for all your help!

hjortur17 left a reply on Upgrade-ing To Laravel 5.6 • 4 months ago

The problem is fixed but now I'm having a problem with valet

hjortur17 left a reply on Upgrade-ing To Laravel 5.6 • 4 months ago

Yes, and now only displaying It's work!

hjortur17 left a reply on Upgrade-ing To Laravel 5.6 • 4 months ago

I have not made any changes. I'm trying to use Laravel Valet

hjortur17 left a reply on Upgrade-ing To Laravel 5.6 • 4 months ago

@rin4ik Now I'm getting 502 Gateway. Any ideas why?

nginx/1.12.2

Ideas to fix?

hjortur17 left a reply on Upgrade-ing To Laravel 5.6 • 4 months ago

@rin4ik Thanks a lot! Now it is up and running!

hjortur17 left a reply on Upgrade-ing To Laravel 5.6 • 4 months ago

@rin4ik I tried but did fully understand it

hjortur17 left a reply on Upgrade-ing To Laravel 5.6 • 4 months ago

Undefined class constant 'HEADER_CLIENT_IP'

Getting this error when trying that

hjortur17 left a reply on Upgrade-ing To Laravel 5.6 • 4 months ago

Still getting Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

hjortur17 started a new conversation Upgrade-ing To Laravel 5.6 • 4 months ago

I get an error when trying to do composer update

The error message is: Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

I change to "laravel/framework": "5.6.*" and "php": ">=7.2.4"

Any ideas how I can upgrade it?

Edit Your Profile
Update

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