mleontenko

mleontenko

Member Since 1 Year Ago

Experience Points 390
Experience Level 1

4,610 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 1
Lessons
Completed
Best Reply Awards 0
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.

06 Mar
4 months ago

mleontenko left a reply on ID Column In PostgreSQL (Laravel 5.8)

Can you explain whz?

mleontenko started a new conversation ID Column In PostgreSQL (Laravel 5.8)

I'm creating a laravel application that lets users make a blog post.

The Post model looks like this:


namespace App;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    // Table Name
    protected $table = 'posts';
    // Primary key
    public $primaryKey = 'id';
    // Timestamps
    public $timestamps = true;
}

And this is the migration file:


use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePostsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id')->generatedAs()->always();
            $table->string('title');
            $table->mediumText('body');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('posts');
    }
}```

I'm using a PostgreSQL database and the problem is that $table->increments('id'); makes the ID column "Integer" type instead of "Serial" which is used in Postgres for this type of field.

This creates the following error when I try to update posts:
```Unique violation: 7 ERROR: duplicate key value violates unique constraint "posts_pkey" DETAIL: Key (id)=(1) already exists. (SQL: insert into "posts" ("title", "body", "updated_at", "created_at") values (Post 3, Test test test, 2019-03-06 17:27:37, 2019-03-06 17:27:37) returning "id")```

I need a way to define this field as "serial".
05 Mar
1 year ago

mleontenko left a reply on One Account, Multiple Users On Multiple Computers (Laravel 5.5)

@Snapey don't worry, project is for elementary school workshop. They want one account for each class.

The goal of project is to teach kids about data colection via crowdsourcing. Security is not an issue, nor does any company rely on collected data.

Thanks for the replies :)

02 Mar
1 year ago

mleontenko started a new conversation One Account, Multiple Users On Multiple Computers (Laravel 5.5)

I have Laravel 5.5 application with default Laravel auth enabled. Application is intended to be used by multiple users with the same account at the same time. I tested with 2 computers and it works fine. Is there any limitation on this? I need ~30 users at the same time with the same account.

22 Feb
1 year ago

mleontenko started a new conversation Third Party JS Libraries In Production Version (Laravel 5.5)

I'm using third party js libraries in my Laravel 5.5 project (leaflet and leaflet-draw). I installed the libraries using npm:

npm install leaflet

npm install leaflet-draw

I added the folowing lines in resources/assets/js/app.js:

require('leaflet');

require('leaflet-draw');

and in resources/assets/sass/app.scss:

@import "~leaflet/dist/leaflet.css";

@import "~leaflet-draw/dist/leaflet.draw.css";

after that, I run:

npm run dev

Assets compile and my application works fine on my localhost (i run basic laravel server with php artisan serve).

I tried deploying this application to server. I deployed it to a subfolder, so the address is: https://mysite.com/laravelapplication

I followed this instruction: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-laravel-application-with-nginx-on-ubuntu-16-04

All routes and urls work fine. I don't get any code errors. But, leaflet and leaflet draw libraries have trouble fetching their icons and fonts. I get these errors:

GET https://mysite.com/fonts/vendor/leaflet-draw/dist/images/spritesheet.svg?fd5728f... 404 (Not found)

GET https://mysite.com/images/vendor/leaflet/dist/images/layers.png?a613745... 404 (Not found)

Looks like the library is searching for fonts and icons in the wrong place. It should look in https://mysite.com/laravelapplication instead of https://mysite.com

Does anyone know why this is happening?

mleontenko left a reply on Load Third Party JavaScript Library Stylesheets (Laravel 5.5)

Images and fonts folders copied automatically to public folder and there are no errors in console. Other sprites and icons from library work fine. Could be library specific error...

I tried deploying this application to server. I deployed it to a subfolder, so the address is: https://mysite.com/laravelapplication

I followed this instruction: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-laravel-application-with-nginx-on-ubuntu-16-04

All routes and urls work fine. I don't get any code errors. But, leaflet and leaflet draw libraries have trouble fetching their icons and fonts. I get these errors:

GET https://mysite.com/fonts/vendor/leaflet-draw/dist/images/spritesheet.svg?fd5728f... 404 (Not found)

GET https://mysite.com/images/vendor/leaflet/dist/images/layers.png?a613745... 404 (Not found)

Looks like the library is searching for fonts and icons in the wrong place. It should look in https://mysite.com/laravelapplication instead of https://mysite.com

Or is it using localhost as fallback defined in config/app.php under "Application URL"? 'url' => env('APP_URL', 'http://localhost'),

20 Feb
1 year ago

mleontenko started a new conversation Load Third Party JavaScript Library Stylesheets (Laravel 5.5)

I'm using third party js libraries in my Laravel 5.5 project (leaflet and leaflet-draw). I installed the libraries using npm:

npm install leaflet npm install leaflet-draw

I added the folowing lines in resources/assets/js/app.js:

require('leaflet'); require('leaflet-draw');

and in resources/assets/sass/app.scss:

@import "~leaflet/dist/leaflet.css"; @import "~leaflet-draw/dist/leaflet.draw.css";

after that, I run:

npm run dev

Assets compile and my application works, but I get a weird graphical error. When I draw a marker on map, it is drawn normally but the same marker image is drawn instead of shadow:

marker

If I use CDNs for these libraries, everything looks fine. What am I doing wrong? Also, I checked node_modules\leaflet-draw\dist\images and there is marker-shadow.png inside. After compiling assets, i checked public\images\vendor\leaflet-draw\dist and there are some spritesheets inside, but other images are not there. What am I doing wrong?

02 Feb
1 year ago

mleontenko left a reply on PostGIS Raw SQL Insert (Laravel 5.5)

Is there a way to make controller return the query as a string instead of querying the database? That way I could run it manually and see what is wrong.

mleontenko started a new conversation PostGIS Raw SQL Insert (Laravel 5.5)

I'm making a simple REST service that inserts a point geometry into a PostgreSQL (extended with PostGIS) table along with 2 other string values. Since Eloquent (as far as i know) doesn't support PostGIS functions, I'm using raw SQL queries.

My controller looks like this:

<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Trgovina;
use Validator;

class TrgovinaController extends Controller
{
     /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {   
        $name = $request->input('name');
        $shop = $request->input('shop');
        $geom = $request->input('geom');

        $geom = "ST_TRANSFORM(ST_GeomFromGeoJSON('".$geom."'), 3857)";
           
        
        DB::insert("INSERT INTO trgovinas (name, shop, geom) VALUES (?, ?, ?)", array($name, $shop, $geom));
        return 'Insert Successful';
    }

}

The values sent through the request are: name: Lidl shop: convenience geom = {"type":"Point","coordinates":[18.126712,42.643304],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}}

I get the following error:

HINT:  &quot;ST&quot; &lt;-- parse error at position 2 within geometry (SQL: INSERT INTO trgovinas (name, shop, geom) VALUES (Lidl, convenience, ST_TRANSFORM(ST_GeomFromGeoJSON(&#039;{&quot;type&quot;:&quot;Point&quot;,&quot;coordinates&quot;:[18.126712 42.643304],&quot;crs&quot;:{&quot;type&quot;:&quot;name&quot;,&quot;properties&quot;:{&quot;name&quot;:&quot;EPSG:4326&quot;}}}&#039;), 3857))) in file C:\xampp\htdocs\volonteri\vendor\laravel\framework\src\Illuminate\Database\Connection.php on line 664 ```

If I run the following query in my database, data is inserted correctly:
```INSERT INTO trgovinas (name, shop, geom) VALUES ('Lidl', 'convenience', ST_TRANSFORM(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[18.126712,42.643304],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), 3857))```

Any help debugging this would be apreciated. Is it something about the quotes in query?