afoysal

afoysal

Member Since 4 Years Ago

Experience Points 11,280
Experience Level 3

3,720 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 17
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.

13 Jun
1 month ago

afoysal left a reply on CORS Issue

@B3NDOI - yes, I installed but could not find any solution. Thanks.

afoysal started a new conversation CORS Issue

I am working on a Laravel and Angular project. Project is running well in another Computer but I am getting below error in my Laptop.

enter image description here

Could anyone help me in this regard ?

12 Jun
1 month ago

afoysal left a reply on RelationShip

@MANELGAVALDA - Thanks. Your solution is working.

afoysal left a reply on RelationShip

@MANELGAVALDA - My table name is courses. Thanks.

afoysal left a reply on RelationShip

@WOBBIE - I used this solution. I am getting below error

Illuminate\Database\Eloquent\RelationNotFoundException: Call to undefined relationship [courses] on model [App\Modules\AlAsr\Models\Semester]. in file /var/www/html/alasr/SaaS/vendor/laravel/framework/src/Illuminate/Database/Eloquent/RelationNotFoundException.php on line 34

I have below function in semestercontroller.

public function index(Request $request, $domain) { $semesters = Semester::with('courses')->get(); return response()->json(["semesters" => $semesters, "status"=>200]); }

afoysal started a new conversation RelationShip

I have 2 table semesters and courses. I made a column course_id in semester table. One semester has one course and one course has many semester. How should I write model classes to retrieve semesters.

Thanks.

04 Jun
1 month ago

afoysal left a reply on CORS Issue

Thanks @punksolid . Here is Headers.

enter image description here

afoysal started a new conversation CORS Issue

Previously I fixed CORS issue in another project using this package https://github.com/barryvdh/laravel-cors. But now I could not fix CORS issue in current project. Could anyone help me in this regard ?

https://i.stack.imgur.com/yiD5T.png

30 May
1 month ago

afoysal left a reply on Insert Data In Enum() Field

@MUNAZZIL - @munazzil , What does it mean ?

Here is column details.

https://i.stack.imgur.com/SyFtD.png

afoysal left a reply on Insert Data In Enum() Field

@MUNAZZIL - @munazzil , I am getting same error after creating another table.

afoysal left a reply on Insert Data In Enum() Field

@MUNAZZIL - Thanks @munazzil . Can I copy the table ?

afoysal started a new conversation Insert Data In Enum() Field

I am trying to insert data through postman. My error is like below

"SQLSTATE[01000]: Warning: 1265 Data truncated for column 'salutation' at row 1 (SQL: insert into `students` (`salutation`, `fullName`, `nickname`, `studentId`, `email`, `DOB`, `maritalStatus`, `gender`, `blood_group`, `nationality`, `religion`, `mobileNumber`, `homePhone`, `officePhone`, `emergencyContactNumber`, `present_address`, `permanent_address`, `updated_at`, `created_at`) values (`Mr.`, mouse, hello, laptop, hello, 10/12/2001, Single, Male, A+(ve), dsfsd, 10, mobile, key, 123456, royak, m10, 10, 2019-05-30 10:09:16, 2019-05-30 10:09:16))"

My enum() field is like below

enter image description here

28 May
1 month ago

afoysal left a reply on API Development

@DEVFREY - @devfrey , nothing is logged.

afoysal left a reply on API Development

@CHRISTOPHHARMS - Thanks @christophharms . How can I debug this request ?

afoysal started a new conversation API Development

I am trying to develop an API using Laravel. My code is like below

Route::get('/abcd', function() {
    return response()->json(['name' => 'Abigail', 'state' => 'CA']);
});

enter image description here

But I am getting no output in POSTMAN.

enter image description here

27 May
1 month ago

afoysal left a reply on How Use Different .env File ?

@AURAWINDSURFING - Thanks @aurawindsurfing for your reply. I never worked in several .env file. How to switch between different .env file ? I have to create my own .env file . How I can do this ? Thanks.

afoysal started a new conversation How Use Different .env File ?

I found several .env file in a project . I have to create my own .env file.

How can I use different .env fiile ?

04 Feb
5 months ago

afoysal left a reply on Laravel Project Without Bootstrap Folder

@SERGIU17 - Thanks. It is working.

afoysal left a reply on Laravel Project Without Bootstrap Folder

@SERGIU17 - Laravel version is like below

"name": "laravel/framework", "version": "v4.2.22",

PHP version is like below

PHP Version 5.6.40

afoysal left a reply on Laravel Project Without Bootstrap Folder

@SERGIU17 - Thanks. I am getting error in this line.

$app = new Illuminate\Foundation\Application( $_ENV['APP_BASE_PATH'] ?? dirname(DIR) );

afoysal started a new conversation Laravel Project Without Bootstrap Folder

I have no bootstrap folder in my project folder. I am getting below error.

https://i.stack.imgur.com/Sexlh.jpg

26 Dec
6 months ago

afoysal started a new conversation Integer Overflow

How to Fix integer overflow issue ?

24 Dec
6 months ago

afoysal started a new conversation Using Tinker

How to use Tinker to calling AJAX multiple times ?

01 Oct
9 months ago

afoysal started a new conversation Version Upgrade

How to Upgrade Laravel 5.3 to Laravel 5.7 ?

19 Sep
10 months ago

afoysal started a new conversation Missing Public Folder In Laravel

I received a project from my client. I tried to install it in my local machine using php artisan serve command and I found below error

enter image description here

After searching in Google I found this question. Then I found that there is no public folder in my project directory.

enter image description here

Is there any specific reason to delete this public folder ? or it is left accidentally ?

I changed

chdir($this->laravel->publicPath());

in vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php To :

chdir('/');

as per this question. After that I am getting a blank white page while I am running my project using php artisan serve.

What is the solution ?

08 Aug
11 months ago

afoysal started a new conversation PhpMyAdmin Issue

I am getting below error in phpMyAdmin.

enter image description here

05 Aug
11 months ago

afoysal started a new conversation Passing Optional Parametere

I am developing an API. In this regard I have below route in my api.php file.

Route::post('/upload/{address}', '[email protected]');

Here often I would like to pass address often not. How can I write this route ?

19 Jul
1 year ago

afoysal left a reply on Catching Parameter From URL In Vue.js

Thanks @topvillas . If I use your solution I got error like below.

[Vue warn]: Invalid prop: type check failed for prop "id". Expected String, got Number.

Thanks.

afoysal left a reply on Catching Parameter From URL In Vue.js

Thanks @topvillas . How can I remove this error ?

afoysal started a new conversation Catching Parameter From URL In Vue.js

I am trying to collect id value from URL.

In my index.js of router file I have below code:


    {   path: '/word/:id',
        name: 'word',   
        component: Word,
        props: true,
    }, 

In my component I have below code:


    <script>
        export default {
            props: {
                 id: Number,
            },
            created() {
                 this.routeChanged();
            },
            watch: {
                'id': 'routeChanged',
            },
            methods: {
                routeChanged () {
                    console.log(this.id);
                },
            },
        };
    </script>

I am getting below error:

[Vue warn]: Invalid prop: type check failed for prop "id". Expected Number, got String.
17 Jul
1 year ago

afoysal left a reply on Using HasMany()

Thanks @christianyeah for your reply. Can I get result like below from your solution ?

Product1 --Model 1 --Variant1 --Model2 --Variant1 --Variant2 --Variant3

Product2 --Model1 --Variant1 --Variant2

Thanks.

14 Jul
1 year ago

afoysal left a reply on Relationship In Laravel-5.6

Thanks @Swaz . If I use your solution I am getting all the translations which sentence_id is matched with idof sentences table, but post_id is not matching with the current post id of post table.

13 Jul
1 year ago

afoysal left a reply on Relationship In Laravel-5.6

Thanks @staudenmeir . I am trying with different options. I made post before in SO, then I tried again and made post here. Thanks.

afoysal started a new conversation Relationship In Laravel-5.6

I have three tables like below.

    posts
        id   - integer
        name - string
    
    sentences
        id      - integer
        post_id - integer
        name    - string
    
    translations (word by word)
        id          - integer
        post_id     - integer
        sentence_id - integer
        word_id     - integer
        name        - string

In PostController.php I am trying to fetch data like below

return Post::with(['sentences', 'sentences.translations'])->limit(2)->get();

I have function in post.php model is like below

    protected $primaryKey = '_id';

    public function sentences()
    {
        return $this->hasMany('App\Model\sentence', 'post_id','id');
    }

I have function in sentences.php model is like below

    protected $primaryKey = '_id';
    
    public function translations()
    {
        return $this->morphMany('App\Model\translation', 'sentence_id','id');
    }

I would like to fetch posts along with sentences and translations.

I can fetch post and sentences but I am facing issue while I am trying to fetch translations.

I am getting below error

"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'translations.sentence_id_id' in 'where clause' (SQL: select * from `translations` where `translations`.`sentence_id_id` in (1, 2

12 Jul
1 year ago

afoysal started a new conversation Deploy API

I developed an API using Laravel. How can I deploy it in a Shared Hosting ? Which steps should I take ?

11 Jul
1 year ago

afoysal left a reply on Using HasMany()

public function color()
{
        return $this->hasMany('App\Model\color', 'model_id', 'model_id','varient_id','varient_id');  // Is it possible to use more column name here like this? 
}

afoysal left a reply on Using HasMany()

Thanks @christianyeah . I have another table related to this tables named color. color table has variant_id and model_id. I am using query like you.

How can I make relation with them ?

10 Jul
1 year ago

afoysal left a reply on Catch URL Parameter

Thanks @bobbybouwmann. Actually I am new in Vue.js. I am trying to catch value from URL. I don't know how to do that perfectly. Thanks.

afoysal started a new conversation Using HasMany()

I have three table Product, Model and Variant. Product has many Model. Model has many Variant. There is product_id in Model table. There are product_id and model_id in Variant table.

How can I use hasMany() in Model model class to fetch Products along with Model and Variant in Product controller?

afoysal left a reply on Route Model Binding In Laravel 5.6

Thanks @bobbybouwmann. What should I do if I would like to fetch only 5 Post ?

afoysal left a reply on Route Model Binding In Laravel 5.6

Thanks @newbie360 . I am developing an API. Should I write like this ?

return $post->load('comments')->image;

afoysal left a reply on Route Model Binding In Laravel 5.6

Thanks @bobbybouwmann . One comment has one images.

I have relationship comment model is like below

public function image() { return $this->hasOne('App\Model\image', 'id', 'image_id'); }

How can I attach image with this Query ?

afoysal left a reply on Route Model Binding In Laravel 5.6

Thanks @toby . My parent model post is not loading. Thanks.

afoysal started a new conversation Route Model Binding In Laravel 5.6

I am using Laravel resource controller with route model binding in my API development project. I have below code

public function show(Post $post)
{
    return $post->comments()->get();

}

I am using below URL

http://127.0.0.1:8000/api/posts/1

I would like to retrieve both post values with comments value.

But I am getting only comments values.

09 Jul
1 year ago

afoysal left a reply on Catch URL Parameter

@bobbybouwmann and @m7vm7v I updated the post. Thanks.

afoysal left a reply on Catch URL Parameter

Thanks @bobbybouwmann . watch is working from second time not from first time. Thanks.

afoysal started a new conversation Catch URL Parameter

How can I catch URL parameter when URL changes inside Vue.js Component ?

08 Jul
1 year ago

afoysal left a reply on Get Join Query Result In Different JSON Object Key

Thanks @Tray2 . I know raw SQL but I am looking for Eloquent solution. Thanks.

afoysal left a reply on Navigation In Vue.js

Thanks @Erik. It is not working without path. Thanks.

afoysal started a new conversation Navigation In Vue.js

I have below code in my HTML Code.

    <router-link :to="{ path: '/word/',name: 'word', params: { id: word._id }}"></router-link>

My route settings in index.js like below

    export default new Router({
        mode: 'history',
        routes: [
            {
                path: '/',
                name: 'mainbody',
                component: MainBody
            },
            {
                path: '/word/:id',
                name: 'word',
                component: Word
            }
        ]
    });

But it is not working.