marufalom

marufalom

Member Since 2 Years Ago

Experience Points
1,580
Total
Experience

3,420 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
3
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.

Level 1
1,580 XP
Nov
20
2 weeks ago
Activity icon

Replied to Sqlite General Error Near "auto_increment"

Thank you @rodrigo.pedra . After removing .env.testing it works :D

Activity icon

Replied to Sqlite General Error Near "auto_increment"

@sinnbeck In my php.ini I have pdo_sqlite enabled.

Activity icon

Replied to Sqlite General Error Near "auto_increment"

Eloquent generated Query is:

Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1 near "auto_increment": syntax error (SQL: create table `teachers` (`id` int unsigned not null auto_increment primary key, `name` varchar(100) not null))

Full error log:

Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1 near "auto_increment": syntax error (SQL: create table `teachers` (`id` int unsigned not null auto_increment primary key, `name` varchar(100) not null))
 \vendor\laravel\framework\src\Illuminate\Database\Connection.php:664
 \vendor\laravel\framework\src\Illuminate\Database\Connection.php:624
 \vendor\laravel\framework\src\Illuminate\Database\Connection.php:459
 \vendor\laravel\framework\src\Illuminate\Database\Schema\Blueprint.php:97
 \vendor\laravel\framework\src\Illuminate\Database\Schema\Builder.php:264
 \vendor\laravel\framework\src\Illuminate\Database\Schema\Builder.php:165
 \vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:237
 \database\migrations19_10_10_182138_create_processing_table.php:30
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:360
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:367
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:178
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:147
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:96
 \vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\MigrateCommand.php:71
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:87
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:31
 \vendor\laravel\framework\src\Illuminate\Container\Container.php:572
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:183
 \vendor\symfony\console\Command\Command.php:255
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:170
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:198
 \vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\FreshCommand.php:55
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:87
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:31
 \vendor\laravel\framework\src\Illuminate\Container\Container.php:572
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:183
 \vendor\symfony\console\Command\Command.php:255
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:170
 \vendor\symfony\console\Application.php:934
 \vendor\symfony\console\Application.php:273
 \vendor\symfony\console\Application.php:149
 \vendor\laravel\framework\src\Illuminate\Console\Application.php:89
 \vendor\laravel\framework\src\Illuminate\Console\Application.php:188
 \vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:250
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\PendingCommand.php:136
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\PendingCommand.php:220
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\Concerns\InteractsWithConsole.php:55
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\RefreshDatabase.php:55
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\RefreshDatabase.php:18
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestCase.php:104
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestCase.php:71
 
 Caused by
 Doctrine\DBAL\Driver\PDOException: SQLSTATE[HY000]: General error: 1 near "auto_increment": syntax error
 
 \vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:63
 \vendor\laravel\framework\src\Illuminate\Database\Connection.php:452
 \vendor\laravel\framework\src\Illuminate\Database\Connection.php:657
 \vendor\laravel\framework\src\Illuminate\Database\Connection.php:624
 \vendor\laravel\framework\src\Illuminate\Database\Connection.php:459
 \vendor\laravel\framework\src\Illuminate\Database\Schema\Blueprint.php:97
 \vendor\laravel\framework\src\Illuminate\Database\Schema\Builder.php:264
 \vendor\laravel\framework\src\Illuminate\Database\Schema\Builder.php:165
 \vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:237
 \database\migrations19_10_10_182138_create_processing_table.php:30
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:360
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:367
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:178
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:147
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:96
 \vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\MigrateCommand.php:71
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:87
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:31
 \vendor\laravel\framework\src\Illuminate\Container\Container.php:572
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:183
 \vendor\symfony\console\Command\Command.php:255
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:170
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:198
 \vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\FreshCommand.php:55
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:87
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:31
 \vendor\laravel\framework\src\Illuminate\Container\Container.php:572
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:183
 \vendor\symfony\console\Command\Command.php:255
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:170
 \vendor\symfony\console\Application.php:934
 \vendor\symfony\console\Application.php:273
 \vendor\symfony\console\Application.php:149
 \vendor\laravel\framework\src\Illuminate\Console\Application.php:89
 \vendor\laravel\framework\src\Illuminate\Console\Application.php:188
 \vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:250
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\PendingCommand.php:136
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\PendingCommand.php:220
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\Concerns\InteractsWithConsole.php:55
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\RefreshDatabase.php:55
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\RefreshDatabase.php:18
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestCase.php:104
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestCase.php:71
 
 Caused by
 PDOException: SQLSTATE[HY000]: General error: 1 near "auto_increment": syntax error
 
 \vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:61
 \vendor\laravel\framework\src\Illuminate\Database\Connection.php:452
 \vendor\laravel\framework\src\Illuminate\Database\Connection.php:657
 \vendor\laravel\framework\src\Illuminate\Database\Connection.php:624
 \vendor\laravel\framework\src\Illuminate\Database\Connection.php:459
 \vendor\laravel\framework\src\Illuminate\Database\Schema\Blueprint.php:97
 \vendor\laravel\framework\src\Illuminate\Database\Schema\Builder.php:264
 \vendor\laravel\framework\src\Illuminate\Database\Schema\Builder.php:165
 \vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:237
 \database\migrations19_10_10_182138_create_processing_table.php:30
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:360
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:367
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:178
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:147
 \vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:96
 \vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\MigrateCommand.php:71
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:87
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:31
 \vendor\laravel\framework\src\Illuminate\Container\Container.php:572
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:183
 \vendor\symfony\console\Command\Command.php:255
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:170
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:198
 \vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\FreshCommand.php:55
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:87
 \vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:31
 \vendor\laravel\framework\src\Illuminate\Container\Container.php:572
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:183
 \vendor\symfony\console\Command\Command.php:255
 \vendor\laravel\framework\src\Illuminate\Console\Command.php:170
 \vendor\symfony\console\Application.php:934
 \vendor\symfony\console\Application.php:273
 \vendor\symfony\console\Application.php:149
 \vendor\laravel\framework\src\Illuminate\Console\Application.php:89
 \vendor\laravel\framework\src\Illuminate\Console\Application.php:188
 \vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:250
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\PendingCommand.php:136
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\PendingCommand.php:220
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\Concerns\InteractsWithConsole.php:55
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\RefreshDatabase.php:55
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\RefreshDatabase.php:18
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestCase.php:104
 \vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestCase.php:71
Activity icon

Replied to Sqlite General Error Near "auto_increment"

also tried removing <env name="DB_DATABASE" value=":memory:"/> from phpunit.xml, won't help

Activity icon

Replied to Sqlite General Error Near "auto_increment"

Thank you @nakov and @rodrigo.pedra , I tried all of those steps. My updated configs are:

phpunit.xml

    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="DB_DATABASE" value=":memory:"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="DB_CONNECTION" value="sqlite"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="QUEUE_DRIVER" value="sync"/>
    </php>

env.testing

APP_ENV=testing
APP_KEY=someimportantrandomstrings

APP_DEBUG=true
APP_URL=http://localhost

DB_CONNECTION=sqlite

config/database.php

    'sqlite' => [
            'driver' => 'sqlite',
            'url' => env('DATABASE_URL'),
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => '',
            'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
        ],

Deleted database/database.sqlite file and runs the tests again. Still getting same error but this time there is no database.sqlite added on directory.

Activity icon

Replied to Sqlite General Error Near "auto_increment"

I am using RefreshDatabase trait, DatabaseMigrations also gives me same error.

env.testing

APP_ENV=testing
APP_DEBUG=true
APP_KEY=someimportantrandomstring
DB_DEFAULT=sqlite_testing
APP_URL=http://localhost

DB_CONNECTION=sqlite
DB_DATABASE=database/testing.sqlite

config/database.php

  'sqlite_testing' => [
            'driver'        => 'sqlite',
            'database'  => storage_path() . '/testing.sqlite',
            'prefix'        => '',
        ],

testcase:

public function user_can_visit_teachers_page()
    {
        $teacher = factory('App\Models\Teacher')->create();

        $response = $this->get(route('teachers.index', $teacher->id));

        $response->assertStatus(200);
    }

phpunit.xml

    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="DB_CONNECTION" value="sqlite_testing"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="QUEUE_DRIVER" value="sync"/>
    </php>
Activity icon

Replied to Sqlite General Error Near "auto_increment"

This is how my migration looks like:

Schema::create('teachers', function (Blueprint $table) {
                $table->increments('id');
                $table->string('name', 100);

Factory:

$factory->define(Teacher::class, function (Faker $faker) {
    return [
        'name' => $faker->name
    ];
});

Yea, i've also used mysql and sqlite before didn't have this issue.

Note: I am using Laravel 5.8

Nov
19
2 weeks ago
Activity icon

Started a new Conversation Sqlite General Error Near "auto_increment"

I am using Sqlite for test database. When i run a factory it is showing

SQLSTATE[HY000]: General error: 1 near "auto_increment": syntax error

in SQLite they have autoincrement not auto_increment.

how do I can define a primary key or auto increment for sqlite?

Nov
13
3 weeks ago
Activity icon

Replied to Getting Distance Conditional Relation

Did it by polymorphic relation

Activity icon

Replied to Getting Distance Conditional Relation

Understood polymorphic can be helpful but is there any way I can get it working without polymorphic or scope?

Activity icon

Started a new Conversation Getting Distance Conditional Relation

I have a Product Model which have many Batch Id by type.

Product model

  • id,
  • name

Batch model

  • id
  • product_id,
  • type_id,
  • type

In my batch model i have declared a conditional relation by type.

public function scopeType($query) 
{
      return $query->when($this->type === 'BIS', function ($q) {
            return $q->with('biscuit');
        })->when($this->type === 'CAKE', function ($q) {
            return $q->with('cake');
        })
}

Relation in product model was:

   public function productTypes()
    {
        return $this->hasMany(Type::class, 'product_id')->type();
    }

But it doesn't return type's relation data. If I DDing $this->type on Type' models scope it is showing null

Oct
10
1 month ago
Activity icon

Replied to Bootstrap Dropdown Menu Is Not Opening

sorry, there is an another js file importing bootstrap. Bootstrap should be imported once

Activity icon

Started a new Conversation Bootstrap Dropdown Menu Is Not Opening

Everything about bootstrap is works fine. I've read through other posts too but won't help.

app.js

require('bootstrap');

try {
    window.$ = window.jQuery = require('jquery');
    window.Popper = require('popper.js').default;
    require('bootstrap');
} catch (e) {
    console.log('Doesnt work');
}

app.scss

@import "~bootstrap/scss/bootstrap";

the code i am trying:

<div class="dropdown show">
  <a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Dropdown link
  </a>

  <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
    <a class="dropdown-item" href="#">Action</a>
    <a class="dropdown-item" href="#">Another action</a>
    <a class="dropdown-item" href="#">Something else here</a>
  </div>
</div>

and webpack.mix.js

mix.webpackConfig(webpack => {
    return {
        plugins: [
            new webpack.ProvidePlugin({
                $: 'jquery',
                jQuery: 'jquery',
                'window.jQuery': 'jquery',
                Popper: ['popper.js', 'default']
            }),
           new HardSourceWebpackPlugin()
        ]
    };
});

I am using "bootstrap": "^4.3.1". Can anyone spot out what's the actual error here?

Activity icon

Replied to Why `Framework Running` Taking Too Much Time?

Thanks @tray2 , Took me a day to refactor a large model. This is what i am getting now. I am quite happy with this result 😊

Oct
02
2 months ago
Activity icon

Replied to Localize Enum Or Set Data Type On Laravel

oh nice! thank you

Activity icon

Started a new Conversation Localize Enum Or Set Data Type On Laravel

How can I localize a enum fields.

For example persons table as a enum column status which contain student, teacher, parent. I can translate in blade or resource like this:

$person->status === 'student' ?: trans('app.person_status_student') || $person->status === 'teacher' ?: trans('app.person_status_teacher') || $person->status === 'parent' ?: trans('app.person_status_parent')

This is so odd and will be messy if we have more status value.

Is there any better way to handle this?

Sep
30
2 months ago
Activity icon

Started a new Conversation Remove Items If Exists In Another Collection

I've two collection.

$collection1  = [
    'id' => 1, 
    'id' => 2,
    'id' => 3
];

$collection2  = [
    'id' => 7, 
    'id' => 2,
    'id' => 4
];

I want to remove items from $collection1 if an item is exists in $collection2.

In that case, item with id 2 would be removed.

Sep
09
3 months ago
Activity icon

Replied to Why `Framework Running` Taking Too Much Time?

Thank you @tray2 for your suggestion. Would you mind explaining Consider using SQL over Eloquent relationships this one?

SQL means writing raw SQL with DB Facade or Model?

Sep
08
3 months ago
Activity icon

Started a new Conversation Why `Framework Running` Taking Too Much Time?

My laravel application is getting slow, so, i am trying to debugging with Clockwork

Clockwork tab this is what it is saying. I have populated a model with 500 records which is related to 5-6 other model.

After that my app is getting so slow!

PS: I am requesting API and I do not have any custom middleware

Sep
01
3 months ago
Activity icon

Replied to Laravel 5.2 Migrations - Problem With Default() Method In Migration For A Polymorphic Relationship

Thanks, this is also fixed for me. But why this happen? Is it only with MySql or Other databases too?