miiikkeyyyy

miiikkeyyyy

Member Since 4 Years Ago

Clacton-on-Sea

Experience Points
33,510
Total
Experience

1,490 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
275
Lessons
Completed
Best Reply Awards
9
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 7
33,510 XP
30 Nov
1 year ago

miiikkeyyyy left a reply on Help Needed

Save the array as a flash variable and redirect, once redirected call on the variable.

29 Nov
1 year ago

miiikkeyyyy started a new conversation Larastart Scaffolding

I have created a project called Larastart.

It is free for anybody to use. It comes with the basic authentication scaffold, as well as a few features that I have implemented. Larastart also comes with 12 packages pre-installed.

I created this project as I realised I was doing the same things, over and over again.

Included, so far:

Users Module

  • User Roles and Permissions.
  • Registering Users (User role applied on registering, first user to sign up is super admin [webmaster])
  • Login via Username
  • Confirm Email Address (can be turned on or off. Off by default)
  • List all Profiles (basic page for now)
  • View Individual Profile
  • Edit Profile
  • Edit Settings (updating email address forces re-verifying email).
  • Change Password (requires current password).
  • Deactivate Account (unable to view profile, removes from users list).
  • reCAPTCHA on registration page. (off by default)
  • Online/Offline users. (using the sessions table provided by Laravel).

At the moment I am very open to criticism. So please, take my code and have a dig around. I am going to be constantly working on this project, implementing almost any features that are requested. If you'd like to work alongside me, you're more than welcome.

Thanks in advance guys, I hope some of you's get something out of it.

28 Nov
1 year ago

miiikkeyyyy left a reply on Login With Username, Email Or Phone

Anytime Bro. Glad I could help.

Message me anytime for help. I work with larval as a hobby. So I'm always available to help

miiikkeyyyy left a reply on Login With Username, Email Or Phone

Would this work?

If is numeric, login with number. If is email, login with email address. Else try username?

if(is_numeric($request->get('email'))){
    return ['phone'=>$request->get('email'),'password'=>$request->get('password')];
}
elseif (filter_var($request->get('email'), FILTER_VALIDATE_EMAIL)) {
    return ['email' => $request->get('email'), 'password'=>$request->get('password')];
}
return ['username' => $request->get('email'), 'password'=>$request->get('password')];

27 Nov
1 year ago

miiikkeyyyy started a new conversation Extended Laravel Scaffolding

I've began building a bootstrap for Laravel 5.5 that comes with popular packages pre-installed and a few popular features.

I'm starting off with the login and registration, using Laravels original authentication.

I've changed the log in credentials so that you login via username and password (which is easier than I remembered, guessing that was snuck in an update whilst I was away). And I've set an event so that when a user is created it'll trigger some event listeners such as SendConfirmafionEmail, AssignUserRole and AssignUserProfile so that I do not have to edit the existing code too much.

I've even set it up so that the first ever registrated user is super admin and anybody after is given role of a standard user.

I've got an edit settings and an edit profile page. And all is working rather smoothly.

My questions are:

  • What is the best Laravel friendly user role system available? (One I've got uses too many queries and is ugly)
  • What features would you want, readily available when you first install Laravel?

miiikkeyyyy left a reply on I've Been Away.

Thanks bro! It's great to be back! I've actually missed coding so much! Been coding until 7am every morning, it's crazy!

24 Nov
1 year ago

miiikkeyyyy left a reply on Add Show Textbox

Your function is set out like this:

function GetDynamicTextBox(value) {
    return '<td><textarea name = "product"  type="text" ' + value + '" class="form-control" /></td>'  + value + '" /></td>'+ '<td><textarea name = "product" type="text"' + value + '" class="form-control" /></td>' + '<td><button type="button" class="btn btn-danger remove">X</button></td>'
}

When clicking #btnAdd you call a function GetDynamicTextBox(""). You're setting the default value to nothing.

You need to specify the default value when calling the GetDynamicTextBox field. Change "[DEFAULT VALUE]" to whatever you need it to be.

$("#btnAdd").bind("click", function () {
var div = $("<tr />");
div.html(GetDynamicTextBox( [DEFAULT VALUE] ));
$("#TextBoxContainer").append(div);
});
$("body").on("click", ".remove", function () {
$(this).closest("tr").remove();
});
});

miiikkeyyyy started a new conversation Authenticating Users

My script has made use of spatie/laravel-permission.

I am primarily focused on updating profile. At the moment, I've "got to green" and I am in the process of refactoring the code.

I have noticed in [email protected] I query for a user, however I send ANOTHER query in the EditProfileRequest.php.. So I'm calling two of the same queries.

Any suggestions on cleaning up the code would be great.

ProfileController.php

<?php

namespace App\Http\Controllers;

use App\Http\Requests\EditProfileRequest;
use App\Role;
use App\User;
use Illuminate\Http\Request;

class ProfileController extends Controller
{
    /**
     * ProfileController constructor.
     *
     */
    public function __construct()
    {
        $this->middleware('auth')->except('show');
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($username)
    {
        $user = User::where('username', $username)->firstOrFail();

        return view('profiles.show', compact('user'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  string $username
     * @return \Illuminate\Http\Response
     */
    public function edit($username)
    {
        $user = User::where('username', $username)->firstOrFail();

        if( ! auth()->user()->can('update-profile', $user))
        {
            return back();
        }

        return view('profiles.edit', compact('user'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  string  $username
     * @return \Illuminate\Http\Response
     */
    public function update(EditProfileRequest $request, $username)
    {
        $user = User::where('username', $username)->firstOrFail();

        $user->update([
            'username' => request('username'),
            'email' => request('email'),
        ]);

        return redirect(route('profiles', ['username' => $user->username]))->with('flash','Profile updated.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}

And "EditProfileRequest.php"

<?php

namespace App\Http\Requests;

use App\User;
use Illuminate\Foundation\Http\FormRequest;

class EditProfileRequest extends FormRequest
{
    /**
     * EditProfileRequest constructor.
     *
     * @param array $query
     * @param array $request
     * @param array $attributes
     * @param array $cookies
     * @param array $files
     * @param array $server
     * @param null $content
     */
    public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
    {
        parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content);

        $this->user = User::where('username', request()->get('original_username'))->firstOrFail();
    }

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return $this->user && $this->user()->can('update-profile', $this->user);
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'username' => 'required|string|max:255|unique:users,username,' . $this->user->username . ',username',
            'email' => 'required|string|email|max:255|unique:users,email,' . $this->user->username . ',username',
        ];
    }
}
21 Nov
1 year ago

miiikkeyyyy left a reply on Does Your Vue Do Nothing?

I'm still getting my head around it.

I'm lost completely to be honest.

Any idea why this code keeps losing categories?

\View::composer('*', function ($view) {
            $channels = \Cache::rememberForever('channels', function () {
                return Channel::all();
            });

            $view->with('channels', $channels);
        });
20 Nov
1 year ago

miiikkeyyyy left a reply on Does Your Vue Do Nothing?

Ok, I'm assuming there's some sort of view caching going on. 36 hours of tutorials and coding is hurting my eyes :(

miiikkeyyyy started a new conversation Does Your Vue Do Nothing?

I'm not sure what's going on. It seems to me as if Vue is very temperamental.

I'm doing the Build a Forum series. And I couldn't get the flash notifications to work, so I decided to skip it out of anger and download the source files from a few episodes later. Then, out of nowhere, the vue scripts started working.

Some of them work, as of now, I am notified when I post a thread and a reply. The inline edit reply on a thread works. But the delete button doesn't.

And as I've been going over the code I've noticed the craziest thing.

view-source:http://laravel.dev/threads/category-1/5

                  <div class="panel-footer level">
                <button class="btn btn-xs mr-1" @click="editing = true">Edit</button>

                <form method="POST" action="/replies/20">
                    <input type="hidden" name="_token" value="Qsh10UyUH8mGLzYesKkICBwPzTirktgkX3l6VFhs">
                    <input type="hidden" name="_method" value="DELETE">

                    <button type="submit" class="btn btn-danger btn-xs">Delete</button>
                </form>
            </div>
            </div>

Whereas in reply.blade.php it is:

        @can ('update', $reply)
            <div class="panel-footer level">
                <button class="btn btn-xs mr-1" @click="editing = true">Edit</button>
                <button class="btn btn-xs btn-danger mr-1" @click="destroy">Delete</button>
            </div>
        @endcan

4:43am and I'm tired. Am I missing something? I've done php artisan clear:cache, just in case. Cleared all browsing data. And still it's crazy.

OK! Before I managed to post this to this forum. I changed reply.blade.php and removed the @can functionality. Refreshed the page, and it worked! Added the @can functionality back.. AND IT STILL WORKS! WHAT IS LIFE?!

Someone, any idea?

miiikkeyyyy left a reply on Getting Error On Validation, When I'm Not Trying To Validate

When I stop trying, I worked it out.

Silly mistake to make.

I duplicated a line in the routes file, and edited the uri. However didn't update the controller.. Sorted :/

miiikkeyyyy started a new conversation Getting Error On Validation, When I'm Not Trying To Validate

I'm on Episode 18: Let's Build A Forum with Laravel and TDD: A User Can Favorite Replies (https://laracasts.com/series/lets-build-a-forum-with-laravel/episodes/18?autoplay=true).

I'm running Laravel 5.5

I'm having to do work arounds, because Jeffrey was working on 5.4 at the time of recording the specific episode.

I'm unsure as to why I keep getting this error: "1) Tests\Feature\FavoritesTest::test_an_authenticated_user_can_favorite_a_reply Illuminate\Validation\ValidationException: The given data was invalid."

Like, as you can see, there's no validation mentioned anywhere. I'm so confused. I try not to post, but I've been stuck for some time. Please, any idea?

<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\TestCase;

class FavoritesTest extends TestCase
{
    use DatabaseMigrations;

    public function test_guests_cannot_favorite_anything()
    {
        $this->withExceptionHandling()
            ->post('replies/1/favorites')
            ->assertRedirect('login');
    }

    /** test */
    public function test_an_authenticated_user_can_favorite_a_reply()
    {
        $this->signIn();

        $reply = create('App\Reply');

        $this->withoutExceptionHandling()
            ->post('replies/' . $reply->id . '/favorites');

        $this->assertCount(1, $reply->favorites);
    }
}
19 Nov
1 year ago

miiikkeyyyy left a reply on Thread Test Error.

I got it to work. For some reason the function wasn't being recognised. I applied "test_" at the beginning of the function and it worked.


namespace Tests\Feature;

use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;

class ThreadsTest extends TestCase
{
    use DatabaseMigrations;

    /**
     *  Test
     */
    public function test_a_user_can_browse_threads()
    {
        $response = $this->get('/threads');

        $response->assertStatus(200);
    }
}

miiikkeyyyy started a new conversation Thread Test Error.

I am running a test, as featured on one of the series. But I'm not getting the same errors.

For some reason my the test 'a_user_can_browse_threads' isn't found even though it is clearly there. Have I missed something?

[all errors and code] "[email protected] MINGW64 /c/wamp/projects/forum $ phpunit PHPUnit 6.4.4 by Sebastian Bergmann and contributors.

W. 2 / 2 (100%)

Time: 203 ms, Memory: 10.00MB

There was 1 warning:

  1. Warning No tests found in class "Tests\Feature\ThreadsTest".

WARNINGS! Tests: 2, Assertions: 1, Warnings: 1."


namespace Tests\Feature;

use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;

class ThreadsTest extends TestCase
{
    use DatabaseMigrations;

    /**
     *  Test 
     */
    public function a_user_can_browse_threads()
    {
        $response = $this->get('/threads');

        $response->assertStatus(200);
    }
}
18 Nov
1 year ago

miiikkeyyyy started a new conversation XAMPP SQL Issues.

I recently installed XAMPP. I've only just started the Let's Build A Forum with Laravel and TDD series. I've done everything as Jeffrey has done.

When migrating database I come up with the following

Setting environment for using XAMPP for Windows.
[email protected] c:\xampp
# cd forum

[email protected] c:\xampp\forum
# php artisan migrate
Migration table created successfully.


  [Illuminate\Database\QueryException]
  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was t
  oo long; max key length is 767 bytes (SQL: alter table `users` add unique `
  users_email_unique`(`email`))



  [PDOException]
  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was t
  oo long; max key length is 767 bytes

I tried to install MySQL not MariaDB or whatever it's called and I kept getting "msvr120.dll missing" error. I got the .dll file and nothing worked. I've resorted in going back to the MariaDB. But am frustrated as I keep getting errors.

I don't want to add a line to each migration so I can set specified key lengths. This must be a common thing, or am I absolutely a dipstick right now?

Thanks in advance.

miiikkeyyyy started a new conversation I've Been Away.

I've been in and out of work, and finally I'm back in stable full time employment.

I've re-subscribed. And I can't wait to get started! So glad you're still here!

17 Apr
3 years ago

miiikkeyyyy left a reply on How About A Down/dislike Button?

Oh pants, so I did all that for nothing? Christ almighty! I wish there was a dislike button so I can dislike my own post!

miiikkeyyyy left a reply on How About A Down/dislike Button?

I'm on my phone and have no testing environment but try something like adding a pivot table such as post_dislikes with user_id and post_id.

Then in the post model have:

function dislikes()
{
    return $this->hasMany(Dislikes::class);
}

Then user model:

function dislikes()
{
    return $this->hasMany(User::class);
}

Then create a Dislike model and have

function user()
{
    return $this->belongsTo(User::class);
}

function post()
{
    return $this->belongsTo (Post::class);
}
09 Apr
3 years ago

miiikkeyyyy left a reply on Turn String Into An Array

That isn't a string, is it? Is it not JSON? Would JSON to array not work?

miiikkeyyyy left a reply on Add Column Without Artisan Refresh

You simply add a new migration like: php artisan make:migration AddNewColoumnToUsersTable then add a column to a table that already exists then run php artisan migrate.

02 Apr
3 years ago

miiikkeyyyy started a new conversation Command From Service Provider

This is my InstalledServiceProvider.

It's a very simple tool that I am creating that will check to see if a file exists, if the file doesn't exist it'll run install and create a file called .installed, similar to how Laravel's Maintenance Mode works.

Is there any way I can call a command from this? like: php artisan migrate

This is my code so far:

<?php

namespace App\Providers;

use Illuminate\Support\Facades\File;
use Illuminate\Support\ServiceProvider;

class InstalledServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        // Check to see if we are installed
        if ( ! File::exists(base_path('.installed'))) {

            // Create .installed file
            File::put(base_path('.installed'), null);

            // Redirect to homepage
            redirect('/');
        }
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}
10 Mar
3 years ago

miiikkeyyyy left a reply on Errors In .blade.php

You haven't parsed the variable from the controller into the view :)

You need to add:

    return view('auth.login', compact('validator'));

miiikkeyyyy started a new conversation Foreign Key Constraints

I have a migration for a user_follows table. I ant to add a foreign key to both the follower_id and the followed_id

I get this error for some reason.

SQLSTATE[23000]: Integrity constraint violation: 1217 Cannot delete or
update a parent row: a foreign key constraint fails 

This is my migration.

    public function up()
    {
        Schema::create('user_follows', function(Blueprint $table) {
            $table->increments('id');
            $table->integer('follower_id')->unsigned();
            $table->integer('followed_id')->unsigned();
            $table->timestamps();

            $table->foreign('follower_id')
                ->references('id')
                ->on('users')
                ->onDelete('cascade');

            $table->foreign('followed_id')
                ->references('id')
                ->on('users')
                ->onDelete('cascade');

            $table->primary(['follower_id', 'followed_id']);
        });
    }
07 Mar
3 years ago

miiikkeyyyy left a reply on User Creation Set Password Event

Sorry, I did this on my phone. Hope it works :)

miiikkeyyyy left a reply on User Creation Set Password Event

I'd personally try something like this:

$plain_password = str_random(10);
$hashed_password = bcrypt($plain_password);

User::create([
    'password' = $hashed_password;
]);

Then underneath fire an email to the new user registered with the plain password variable :)

04 Mar
3 years ago

miiikkeyyyy left a reply on Project Larabook

I watched the series, even though it's outdated. And I can still say that I learned from it.

Needless to say there were a lot of places I had to come up with my own conclusion and put different codes in different places but I managed go get a dashboard and user following system created out of it.

With PHP/Laravel experience I'm sure you can do it too. If not, get used to 5.2 first and then watch the video :)

03 Mar
3 years ago

miiikkeyyyy started a new conversation User Following Pivot Table

I have managed to get the user to follow another user, fine, but when it comes to checking the table I get this Call to undefined method Illuminate\Database\Query\Builder::list() (View: C:\wamp\www\larastart\resources\views\profile\partials\follow_form.blade.php) (View: C:\wamp\www\larastart\resources\views\profile\partials\follow_form.blade.php) error.

Here is follow_form.blade.php:

@if($user->isFollowedBy(auth()->user()))
    You are following.
@else
    <div class="media">
        {{ Form::open(['url' => '/follow']) }}
        {{ Form::hidden('followed_id', $user->id) }}

        <button type="submit" class="btn btn-primary">Follow</button>
        {{ Form::close() }}
    </div>
@endif

Here is my User.php

    /**
     * A user belongs to many follows.
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function follows()
    {
        return $this->belongsToMany(User::class, 'follows', 'follower_id', 'followed_id');
    }

    /**
     * Follow a user.
     *
     * @param $user
     * @return mixed
     */
    public function follow($user)
    {
        return $this->follows()->attach($user->id);
    }

    /**
     * Check to if user is following another user.
     *
     * @param User $current_user
     * @return bool
     */
    public function isFollowedBy(User $current_user)
    {
        $idsOfUsersIFollow = $current_user->follows()->list('followed_id');

        return in_array($this->id, $idsOfUsersIFollow);
    }

miiikkeyyyy started a new conversation Updating Authenticated User.

I have this code below, which works absolutely fine. Would this be considered bad practice to use the auth() helper or should I use the proper query?

    /**
     * Update Users Profile
     *
     * @param Request $request
     * @return \Illuminate\Http\RedirectResponse
     */
    public function postEditProfile(Request $request)
    {
        auth()->user()->profile()->update([
            'name' => $request->get('name'),
            'country' => $request->get('country'),
            'hometown' => $request->get('hometown'),
            'bio' => $request->get('bio')
        ]);

        flash()->success('Your profile has successfully been updated.');

        return redirect()->back();
    }
01 Mar
3 years ago

miiikkeyyyy left a reply on Socialite With Multiple Login Options

I would have a separate table called "user_services" and have fields like user_id, service_provider, service_provider_id.

Then when they select Github you'll run an sql query that gets "where service_provider = $service_provider AND service_provider_id =service_provider_id"

Then with that result you can LoginUsingId($result->id)

28 Feb
3 years ago

miiikkeyyyy left a reply on Orderby From Another Table.

I've managed to do it.

The query wasn't being touched at all for some reason.

What I did was joined manually to the users table:

        $users = User::with('profile')
            ->join('user_profile', 'id', '=', 'user_profile.user_id')
            ->orderBy('user_profile.name', 'ASC')
            ->paginate(24);

miiikkeyyyy left a reply on Orderby From Another Table.

Nope, I'm afraid that hasn't worked either :/

miiikkeyyyy started a new conversation Orderby From Another Table.

I have a users and a users_profiles table.

I want my users to be ordered by their names in alphabetical order.

My code so far is

        $users = User::with(['profile' => function($q) {
            return $q->orderBy('name');
        }])->paginate(24);

I get the results but not in the order I want.

miiikkeyyyy left a reply on Code Review

I believe somebody had the same issue on Github.

Something about xdebug or something, check out the link :)

18 Feb
3 years ago

miiikkeyyyy left a reply on Laracasts Markup

I was struggling to find out, as soon as I used the word "parser" I found https://github.com/GrahamCampbell/Laravel-Markdown.

Thank you. I get stuck on some silly things :)

miiikkeyyyy started a new conversation Laracasts Markup

Does anybody know if the markup is public?

I have a user profile and I want users to be able to format their own bio.

Thanks in advance.

miiikkeyyyy started a new conversation Get Longitude/Latitude From Address.

I have installed a package, toin0u/Geotools-laravel, from GitHub.

What I'm looking to do is have two fields on the register page one has "Country" and the other is "Hometown". They are stored in the database formatted like: "United Kingdom, Essex".

What I want to do is get the longitude and latitude via the address.

I watched an episode on here where Jeffrey did it, using Google Maps and Vue but I want it to all be done in the controller. With the package I've installed, is what I want possible?

13 Feb
3 years ago

miiikkeyyyy left a reply on Where Are You All From?

Essex, England :)

11 Feb
3 years ago

miiikkeyyyy left a reply on I Don't Know How To Install My Own Git Repository.

Wonderful, thank you very much :D

miiikkeyyyy started a new conversation I Don't Know How To Install My Own Git Repository.

I have created a project called Larastart

But I don't actually know how to install it.

I know some people have successfully downloaded and installed it but I don't know how to.

Could somebody tell me how? So I could then write a step by step guide for others to use it, please?

miiikkeyyyy left a reply on Using Auth::user() In Error Blade In Laravel 5.2

Try using the auth() helper function.

// Grab email address, for example.
auth()->user()->email

miiikkeyyyy left a reply on Price Of Laracasts Uses ?

@Hamelraj add your bank details, then a new option in your settings will be made available where hoi choose your plan :)

miiikkeyyyy left a reply on Scaffolding In Laravel

I did a Google search and found this, if it helps: https://packagist.org/packages/appzcoder/crud-generator.

10 Feb
3 years ago

miiikkeyyyy left a reply on Collection SortBy

That didn't work.

I had to use the SortBy before plucking them:

Countries::sortBy('name')->pluck('name','id');

miiikkeyyyy left a reply on Why I Got <p> On Preview

If I could use the emoji monkeyseenoevil emoji. I would! Haha I always forget helper functions

miiikkeyyyy left a reply on Why I Got <p> On Preview

Go into the controller and add the STR facade.

At the top, under namespace app;

use Illuminate\Support\Str;

miiikkeyyyy left a reply on Why I Got <p> On Preview

That's because you forgot to add the function limit.

{!! Markdown::parse(Str::limit($news->body, 100)) !!}

miiikkeyyyy left a reply on Why I Got <p> On Preview

It's the brackets mate:

The {{ }} will escape any HTML tags, to prevent exploitation. So it turns <p></p> into &lt;p&gt;&lt;/p&gt;.

Use {!! !!} instead.

Try

{!! Markdown::parse($news->body) !!}

miiikkeyyyy left a reply on Collection SortBy

This works

    $countries = Countries::select('name','id');

        return $countries->orderBy('name','asc')->get();

But it doesn't format the collection so that I can use it in the Form::select helper as it comes out like

<option value="0">{"id":1,"name":"test"]</option>

miiikkeyyyy started a new conversation Collection SortBy

I have a collection of countries but it won't sort them alphabetically by their name?

        $countries = Countries::pluck('name','id');

        return $countries->sortBy('name');

Have I missed something?