iamssingh

iamssingh

Member Since 11 Months Ago

Jaipur, Rajasthan, India

Experience Points
3,270
Total
Experience

1,730 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
26
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 1
3,270 XP
Sep
24
1 month ago
Activity icon

Replied to Unable To Migrate Table Using Point Datatype In Postgres ?

For anyone, who need the approach to write the perfect code for raw query in this case, I have put my code below. We will be making custom PostgresGrammar class with our overrided method definition. While using it in migration, we simply need to register out Grammer Class here.

Here is the CustomPostgresGrammar -

	<?php
		namespace App\Grammer;

		use Illuminate\Database\Schema\Grammars\PostgresGrammar;
		use Illuminate\Support\Fluent;

		/**
 		* Extended version of PostgresGrammar with
 		* support of 'point' data type in Postgres.
 		*/
		class ExtendedPostgresGrammar extends PostgresGrammar
		{

    		/**
     		* Create the column definition for a spatial Point type.
     		*
     		* @param  \Illuminate\Support\Fluent  $column
     		* @return string
     		*/
    		protected function typePoint(Fluent $column)
    		{
        	return "$column->type";
    		}

	}

Here is the migration file code -

    public function up() {
        // register new grammar class
        DB::connection()->setSchemaGrammar(new ExtendedPostgresGrammar());
        $schema = DB::connection()->getSchemaBuilder();
        $schema->create('locations', function (Blueprint $table) {
            $table->bigInteger('id');
            $table->point('points'); 
            $table->datetimetz('created_at');
         });
     }

Activity icon

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

@bobbybouwmann Yeah, I have ended up with that.

What can be a best approach to do that ? I am thinking to make a trait which will contain a method for alter query. That trait will be used in the migration which are using point datatype.

Do you have any other approach for it ?

Sep
23
1 month ago
Activity icon

Replied to Unable To Migrate Table Using Point Datatype In Postgres ?

@sinnbeck Using raw query will only be a good solution.

Activity icon

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

@bobbybouwmann @r3n

Hey guys, I wanna add point datatype in a table using migration in laravel 5.8. Unable to do that. Migration is adding geography datatype.

For more go on this link - https://laracasts.com/discuss/channels/laravel/unable-to-migrate-table-using-point-datatype-in-postgres

Activity icon

Replied to What Is The Latest Stable Version Of Laravel ?

@JeffreyWay @sinnbeck or anyone with a good knowledge base is appreciated to answer the question.

Activity icon

Started a new Conversation What Is The Latest Stable Version Of Laravel ?

I read a lot of blogs about it, everyone has different opinion. I want to stick with the one, which is latest & stable ?

Activity icon

Replied to Unable To Migrate Table Using Point Datatype In Postgres ?

Okay, Will it be better to upgrade laravel 5.8 to laravel 8.0 ? Is laravel 8.0 stable ?

Activity icon

Replied to Unable To Migrate Table Using Point Datatype In Postgres ?

@sinnbeck You checked at Larvel 8.0 files. Checkout in Laravel 5.8.

Here it is - https://github.com/laravel/framework/blob/5.8/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php#L905

Is there any other way, where we could define custom datatype while making migration ?

Activity icon

Replied to Unable To Migrate Table Using Point Datatype In Postgres ?

I go through your link - https://postgis.net/install . While hitting below queries.

 	CREATE EXTENSION postgis_raster;
 	CREATE EXTENSION postgis_sfcgal;

I got below errors -

ERROR:  Extension "postgis_raster" is not supported by Amazon RDS
DETAIL:  Installing the extension "postgis_raster" failed, because it is not on the list of extensions supported by Amazon RDS.
HINT:  Amazon RDS allows users with rds_superuser role to install supported extensions. See: SHOW rds.extensions;
SQL state: 22023

ERROR:  Extension "postgis_sfcgal" is not supported by Amazon RDS
DETAIL:  Installing the extension "postgis_raster" failed, because it is not on the list of extensions supported by Amazon RDS.
HINT:  Amazon RDS allows users with rds_superuser role to install supported extensions. See: SHOW rds.extensions;
SQL state: 22023

Are these both(postgis_sfcgal,postgis_raster) are also required for using postgres spatial database datatype ?

Activity icon

Replied to Unable To Migrate Table Using Point Datatype In Postgres ?

@sinnbeck When I run SELECT name FROM pg_available_extensions; It shown me all the enabled extension.

Postgis was already there. Still, I created again using CREATE EXTENSION postgis; and migration started working. This migration is creating geography datatype field, not point datatype .

Activity icon

Replied to Unable To Migrate Table Using Point Datatype In Postgres ?

No, It's not. Using GUI editor, I am able to add point column.

Activity icon

Replied to Unable To Migrate Table Using Point Datatype In Postgres ?

@sinnbeck yeah, I am able to create tables using point datatype in postgres manually.

Activity icon

Replied to Unable To Migrate Table Using Point Datatype In Postgres ?

@sinnbeck To use Spatial Datatypes in laravel, do we need to do something else ?

Activity icon

Replied to Unable To Migrate Table Using Point Datatype In Postgres ?

@sinnbeck Yeah, It is giving same resopnse.

   Illuminate\Database\QueryException  : SQLSTATE[42704]: Undefined object: 7 ERROR:  type "geography" does not exist at character 92 (SQL: create table "clients_users_locations" ("id" bigserial primary key not null, "point_table" geography(point, 4326) not null, "created_by" bigint not null, "created_at" timestamp(0) with time zone not null))

  at /opt/lampp/htdocs/project/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668| 

  Exception trace:

  1   Doctrine\DBAL\Driver\PDOException::("SQLSTATE[42704]: Undefined object: 7 ERROR:  type "geography" does not exist at character 92")
      /opt/lampp/htdocs/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:129

  2   PDOException::("SQLSTATE[42704]: Undefined object: 7 ERROR:  type "geography" does not exist at character 92")
      /opt/lampp/htdocs/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:127

Activity icon

Started a new Conversation Unable To Migrate Table Using Point Datatype In Postgres ?

I have a migration file which contains point datatype. It is laravel 5.8. While migrating I am getting below error.

  Illuminate\Database\QueryException  : SQLSTATE[42704]: Undefined object: 7 ERROR:  type "geography" does not exist at character 92 (SQL: create table "clients_users_locations" ("id" bigserial primary key not null, "point_table" geography(geometry, 4326) not null, "created_by" bigint not null, "created_at" timestamp(0) with time zone not null))

  at /opt/lampp/htdocs/project/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668| 

  Exception trace:

  1   Doctrine\DBAL\Driver\PDOException::("SQLSTATE[42704]: Undefined object: 7 ERROR:  type "geography" does not exist at character 92")
      /opt/lampp/htdocs/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:129

  2   PDOException::("SQLSTATE[42704]: Undefined object: 7 ERROR:  type "geography" does not exist at character 92")


Here is my migration file -

    public function up()
    {
        Schema::create('clients_users_locations', function (Blueprint $table) {
            $table->bigInteger('id', true);
            $table->geometry('point_table');
            $table->bigInteger('created_by');
            $table->datetimetz('created_at');
        });
    }

What am I missing here ?

Aug
07
2 months ago
Activity icon

Awarded Best Reply on Migration-Generator For Laravel 6

I used this package - https://github.com/oscarafdev/migrations-generator

It worked for me.

Activity icon

Started a new Conversation Migration-Generator For Laravel 6

Hii there, I want to generate migration from database in laravel. How can i do that in Laravel 6. I have used barryvdh/laravel-migration-generator & xethron packages. But they are not compatible for Laravel 6. What can be made ?

Jul
12
3 months ago
Activity icon

Started a new Conversation How Can I Be A Laravel Certified Developer ?

Hii guys, This is Suraj Singh. I want to be a Laravel Certified Developer. Which platform I can go for ? What are the top most certification for Laravel ? I would love to hear from you guys.

Thanks & Regards

Suraj Singh

May
15
5 months ago
Activity icon

Started a new Conversation Insert ToArray() Data Using DB::table In Larvel ?

I have data in below format=>

[
	{
		"0":["a","b","c","d","D",null],
		"1":["f","f","c","e","c","1"]
	}
]

How can i insert this data in table using DB::insert() at once, without foreach ? Can we do it without foreach ? I am getting this data from toArray(). I can even fetch data using collection() . Let me know which one i should to insert data in one shot.