R3N

R3N

Member Since 1 Year Ago

Experience Points
21,100
Total
Experience

3,900 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
195
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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 5
21,100 XP
Aug
28
2 months ago
Activity icon

Commented on Build The Explore Users Page

Laracasts PHP courses are aweful for beginners since it goes too fast in difficulty and straight into laravel. If you want video this is the best series I have seen, https://www.youtube.com/playlist?list=PLfdtiltiRHWHjTPiFDRdTOPtSyYfz3iLW I took all PHP series in Laracasts and even Lynda/linkedin learning yet didn't learn as much as I did with Alex youtube playlist.

Aug
15
2 months ago
Aug
12
2 months ago
Activity icon

Commented on Limit Access To Authorized Users

Thank you so much, saved me hours. By the way the replies migration will not work

    public function up()
    {
        Schema::create('replies', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('user_id');
            $table->unsignedBigInteger('conversation_id');
            $table->text('body');
            $table->timestamps();

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

            $table->foreign('conversation_id')
            ->references('id')
            ->on('conversations')
            ->onDelete('cascade');
        });
    }

Replaced

$table->id()

with

$table->bigIncrements('id'); 

to make it work

Jul
28
3 months ago
Activity icon

Commented on Send SMS Notifications In 5 Minutes

Here is alternative with Twilio

Install these package

  1. https://github.com/twilio/twilio-php
  2. https://github.com/laravel-notification-channels/twilio

Create service to start and check verification in app/Services/Twilio/Verification.php

https://github.com/TwilioDevEd/verify-v2-quickstart-php/blob/next/app/Services/Twilio/Verification.php

To send message follow instructions in

  1. https://github.com/laravel-notification-channels/twilio

In PhoneController.php

    public function updatePhone(Request $request)
    {
        $request->validate([
            'phone' => ['required','integer', new Phone],
        ]);

        auth()->user()->phone_verified = false;
        $checkPhone = (new \App\Services\Twilio\Twilio)->startVerification('+' . $request->phone,'sms');

        if ($result->isValid()) {
            auth()->user()->update(['phone' => $request->phone]);
            return response()->json(['success' => 'Phone number successfully Saved'], 200);
        } else {

            return response()->json(['error' => $checkPhone->getErrors()], 403);
        }
    }
    public function verifyPhone(Request $request) {
        $this->validate($request, [
            'code' => 'size:6',
        ]);

        $result = (new \App\Services\Twilio\Twilio)->checkVerification('+' . auth()->user()->phone, $request->code);

        if($result->isValid()) {
            auth()->user()->phone_verified = true;
            auth()->user()->save();

            return response()->json(['success' => 'Phone number successfully Verified'], 200);
        } else {
            return response()->json(['error' => 'incorrect pin number try again or request a new verification number'], 403);
        }

    }

Here you can test the app. https://www.twilio.com/console/api-explorer/sms/messages/create

Activity icon

Commented on Send SMS Notifications In 5 Minutes

Had a problem with Nexmo and contact support they basically told me twice. That I need to "pay" to be able to receive text messages. You basically have to pay 11$ to try the app.. They don't even supply a free phone number like Twilio does.

Apr
28
6 months ago
Activity icon

Replied to PostgreSQL/Postgis Migrations

Solved this by adding to migration

    public function up()
    {
        Schema::create('address', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('address')->nullable();
            $table->point('location')->nullable();
            $table->timestamps();
        });

        DB::statement('CREATE INDEX gix_address_location ON address USING GIST (location);');
    }

Now for GIN just add these instead of GIX

        DB::statement('ALTER TABLE posts ADD searchable tsvector NULL');
        DB::statement('CREATE INDEX posts_searchable_index ON posts USING GIN (searchable)');

Source: https://github.com/pmatseykanets/laravel-scout-postgres

Activity icon

Awarded Best Reply on Need Help With Geospatial Postgres Postgris On Laravel.

Solved it a few hours ago. Was just missing from '' https://postgis.net/docs/PostGIS_FAQ.html

SELECT * FROM geotable
WHERE ST_DWithin(geocolumn, 'POINT(1000 1000)', 100.0);

Here the working code.

$kilometers = 1 * 1000;
//      $miles =  1 * 1609.34;
$currentLocation = $address->location->toWKT();
$nearby = Address::whereRaw("ST_DWithin (location, '$currentLocation', $kilometers)")->get()->except($address->id);

Activity icon

Replied to Need Help With Geospatial Postgres Postgris On Laravel.

Solved it a few hours ago. Was just missing from '' https://postgis.net/docs/PostGIS_FAQ.html

SELECT * FROM geotable
WHERE ST_DWithin(geocolumn, 'POINT(1000 1000)', 100.0);

Here the working code.

$kilometers = 1 * 1000;
//      $miles =  1 * 1609.34;
$currentLocation = $address->location->toWKT();
$nearby = Address::whereRaw("ST_DWithin (location, '$currentLocation', $kilometers)")->get()->except($address->id);

Activity icon

Started a new Conversation Need Help With Geospatial Postgres Postgris On Laravel.

https://i.imgur.com/KTFUUDh.png

I misspell location to locatimon on purpose. To see the correct working syntax. The issue is here

geography (ST_Point(-66.118892 18.465387)

It has no comma and that is what is causing the error.

I am saving the point using https://github.com/mstaack/laravel-postgis

     $location = new Point($latitude,$longitude);

This is how the point been saved in my database. https://i.imgur.com/tqgjrzO.png

This is code works correctly.

        $nearby = "select * from address WHERE ST_DWithin (location,geography (ST_Point(-66.1160422, 18.4682047)), $kilometers)";

        dd(DB::select($nearby));

But when I use this code, It does not work.

        $nearby = "select * from address WHERE ST_DWithin (location,geography (ST_Point($address->location)), $kilometers)";
Activity icon

Replied to Doest $table->spatialIndex('location'); Support PostgreSQL ?

I see, appreciate your help. It was difficult since there seems to not be much resources online. Manage to resolve it by reading the docs of other github packages that deal with PostGIS.

Apr
27
6 months ago
Activity icon

Awarded Best Reply on Doest $table->spatialIndex('location'); Support PostgreSQL ?

I found this just now doing research online for hours. https://github.com/pmatseykanets/laravel-scout-postgres

class CreatePostsTable extends Migration
{
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');
            $table->text('title');
            $table->text('content')->nullable();
	    $table->point('geog');
            $table->integer('user_id');
            $table->timestamps();
        });

        DB::statement('CREATE INDEX gix_test_geog ON test USING GIST (geog);');
    }

    public function down()
    {
        Schema::drop('posts');
    }
}

Finally got it to work Using these resources.

https://github.com/mstaack/laravel-postgis

https://github.com/pmatseykanets/laravel-scout-postgres

Apr
26
6 months ago
Activity icon

Replied to Doest $table->spatialIndex('location'); Support PostgreSQL ?

Now my issue is how do I add to eloquent

CREATE TABLE test (geog GEOGRAPHY(POINT));

My guess is that this add it to eloquent

    $table->point('geog');

My understanding is correct right?

Activity icon

Replied to Doest $table->spatialIndex('location'); Support PostgreSQL ?

I found this just now doing research online for hours. https://github.com/pmatseykanets/laravel-scout-postgres

class CreatePostsTable extends Migration
{
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');
            $table->text('title');
            $table->text('content')->nullable();
	    $table->point('geog');
            $table->integer('user_id');
            $table->timestamps();
        });

        DB::statement('CREATE INDEX gix_test_geog ON test USING GIST (geog);');
    }

    public function down()
    {
        Schema::drop('posts');
    }
}

Finally got it to work Using these resources.

https://github.com/mstaack/laravel-postgis

https://github.com/pmatseykanets/laravel-scout-postgres

Activity icon

Replied to Doest $table->spatialIndex('location'); Support PostgreSQL ?

I am confused because of this https://github.com/laravel/framework/pull/21070

Note: At this moment I've implemented only MySQL grammar SPATIAL INDEX support.

But not sure if that changed in the past 3 years.

Activity icon

Started a new Conversation Doest $table->spatialIndex('location'); Support PostgreSQL ?

I need to implement this spartial GIST index for Postgist

CREATE TABLE test (geog GEOGRAPHY(POINT));
CREATE INDEX gix_test_geog ON test USING GIST (geog);
INSERT INTO test (geog)
	VALUES (ST_Point(-66.1160422, 18.4682047)),
		(ST_Point(-66.1200, 18.4682));

So Wondering if using this would be good enough? to Create the Index? As well if this compatible with Postgres?

https://laravel.com/docs/7.x/migrations#indexes

$table->spatialIndex('location');

Really confused about this and there is not much info online.