xuuto

Member Since 4 Years Ago

Experience Points
5,330
Total
Experience

4,670 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
36
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.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 2
5,330 XP
May
31
1 week ago
Activity icon

Awarded Best Reply on Laravel Ajax With Bootstrap Single Modal On Edit And Create, On Create Modal Previous Edit Modal Select 2 Option Value Selected Is Still Selected

 $('#gallery_id').val('').trigger('change'); // clear and show default placeholder

this is the code that fixed my problem.

i added this to the new hall pop up modal and and and it clears previous selected option value, showing defualt placeholder

Activity icon

Replied to Laravel Ajax With Bootstrap Single Modal On Edit And Create, On Create Modal Previous Edit Modal Select 2 Option Value Selected Is Still Selected

 $('#gallery_id').val('').trigger('change'); // clear and show default placeholder

this is the code that fixed my problem.

i added this to the new hall pop up modal and and and it clears previous selected option value, showing defualt placeholder

Activity icon

Started a new Conversation Laravel Ajax With Bootstrap Single Modal On Edit And Create, On Create Modal Previous Edit Modal Select 2 Option Value Selected Is Still Selected

hi. i have single bootstrap modal using for creating and editing data with ajax. my modal contains select 2 option value.

when i click on edit modal. and then click on new button to create new data to store, my modal holds previous selected option value on edit form. not clearing on the prevous selected value on edit.

my code is as follow.

 $('#newHall').click(function (e) {
            e.preventDefault();
            $('#btn-save').val('create new Hall');
            $('#hall_id').val('');
            $('#gallery_id').val('');
            $('#hall-form').trigger('reset');
            $('#modal-heading').html("Add new Hall");
            $('#ajaxModal').modal('show');

        });
 $('body').on('click', '#editHall', function () {

            var hall_id = $(this).data('id');
            console.log(hall_id)
            $.get("{{ route('halls.index') }}" + "/" + hall_id + "/edit", function (data) {
                // $('#modal-heading').html('Edit Hall');
                console.log(data);
                $('#btn-save').val('Edit hall');
                // $('#ajaxModal').modal('show');
                $('#hall_id').val(data.id);
                $('#name').val(data.name);
                $('#gallery_id').val(data.gallery_id).trigger('change');
                $('#ajaxModal').modal('show')

                // $('#hall-form').trigger('reset')
                // var = "<option value='"+data.gallery_id+"'>


            })
        });
<script>
        $('document').ready(function () {
            $('#gallery_id').select2({
                $dropdownParent: '#ajaxModal',
                placeholder: 'Select a specific Gallery',
                width: '100%',
                padding: '0',
                allowClear: true,
            })

            $('#hall-gallery_id').select2({
                $dropdownParent: '#ajaxModal',
                placeholder: 'Select a specific Gallery',
                width: '100%',
                padding: '0',
                allowClear: true,
            })

        })
    </script>
May
18
3 weeks ago
Activity icon

Replied to Larave Ajax Datatables Belongsto Relationship Not Saving, Defualt Value Is Empty

thank u very much that helped my problem. and now it is inserting new record, but it wants to reload the page

May
15
4 weeks ago
Activity icon

Replied to Larave Ajax Datatables Belongsto Relationship Not Saving, Defualt Value Is Empty

Yeah i set the default option value. But still getting the same error

Activity icon

Started a new Conversation Larave Ajax Datatables Belongsto Relationship Not Saving, Defualt Value Is Empty

my code

<div class="modal fade" id="ajaxModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
         aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <!-- modal Header -->
                <div class="modal-header">
                    <h5 class="modal-title" id="modal-heading">Modal title</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form id="hall-form" class="form-horizontal">
                        <input type="hidden" name="hall_id" id="hall_id">
                        <div class="form-group">
                            <label for="name">Name</label>
                            <input type="text" name="name" class="form-control" id="name"
                                   placeholder="Enter Hall Name">
                        </div>

                        <div class="form-group">
                            <label for="gallery" class="control-label">Hall Gallery <span class="m-l-5
                            text-danger">*</span></label>
                            <select class="form-control"
                                    id="gallery_id" name="gallery_id">
                                <option value=""></option>
                                @foreach($galleries as $gallery)
                                    <option value="{{ $gallery->id }}">{{ $gallery->name }}</option>
                                @endforeach
{{--                                @error('gallery_id') {{ $message }} @enderror--}}
                            </select>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary" id="btn-save">Save changes</button>
                </div>
            </div>
        </div>
    </div>

my js code

<script type="text/javascript">
        $(function () {
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });

            var table = $('#sampleTable').DataTable({
                processing: true,
                serverSide: true,
                ajax: '{{ route('halls.index') }}',
                columns: [
                    {data: 'id', name: 'id'},
                    {data: 'name', name: 'name'},
                    {data: 'gallery', name: 'gallery.name'},
                    {data: 'created_at', name: 'created_at'},
                    {data: 'Actions', name: 'Actions', orderable: false, serachable: false},
                ],
                order: [[0, 'desc']],
            })
        });
        //
        $('#newHall').click(function (e) {
            e.preventDefault();
            $('#btn-save').val('create new Hall');
            $('#hall_id').val('');
            $('#hall-form').trigger('reset');
            $('#modal-heading').html("Add new Hall");
            $('#ajaxModal').modal('show');

        });

        $('#btn-save').click(function (e) {
            e.preventDefault();
            let id = $('#hall_id').val();
            let name = $('#name').val();
            let gallery_id = $('#gallery_id').val();
            // $(this).html('Sending..');
            console.log(name);

            $.ajax({
                url: "{{ route('halls.store') }}",
                type: "POST",
                data: {
                    id: id,
                    name: name,
                    gallery_id: gallery_id
                },
                dataType: 'json',
                success: function (data) {
                    $('#hall-form').trigger("reset");
                    $('#ajaxModal').modal('hide');
                    table.draw();
                },
                error: function (data) {
                    console.log('Error:', data);
                }
            });
        });

    </script>

my controller code

public function store(Request $request): \Illuminate\Http\JsonResponse
    {
        $validator = Validator::make($request->all(), [
           'name' => 'required',
            'gallery_id' => 'required'
        ]);
        if ($validator->fails()) {
            return response()->json(['errors' => $validator->errors()->all()]);
        }
         Hall::updateOrCreate(['id' => $request->hall_id],
                            ['name' => $request->name],
                            ['gallery_id' => $request->gallery_id]);
        return Response()->json(['success' => 'Hall saved successfully']);
    }

gallery and hall relationship

hall Model

 public function gallery(): BelongsTo
    {
        return $this->belongsTo(Gallery::class);
    }

but it is saving only name but not gallery_id

internal server 500 error. gallery_id doesnot have default value

is returned by error

please help

May
08
1 month ago
Activity icon

Replied to Movie Website , How To Get Casts Of A Movie In My DB, From External Api Tmdb

yeah. i have seen that course. but it about only consuming that external api of movies and rendering in pages. but my project is little diffrent from that, as i have table to save movie details and upload the movie, but to get the casts of this uploaded movie from that api.

get the point?

Activity icon

Started a new Conversation Movie Website , How To Get Casts Of A Movie In My DB, From External Api Tmdb

hi, iam working a project that i want to build a movie website, i have a movie model, which stores movie name, movie url , movie etc.

but when iam showing that specific movie in to the end user , i want to also show the casts of this movie from external Api tmdb, when the user clicks a specific cast thumnail, i want to render actors page for details for that actor from external api tmdb.

so how can i incorporate this casts which are not stored in my db but from external api, tmdb to this movie.

i searched i heard something about imdb_id.

i saw a lot of websites built like that.

when you inspect the url of the image it gives like this https://image.tmdb.org/t/p/w276_and_h350_face/kflgvFCFZnpTRbKmJWn5T0G5EKI.jpg

the website that i think is using something like this concept is www.fanproj.com

Mar
22
2 months ago
Activity icon

Started a new Conversation Is It Appropriate To Use Custom Pivot Models For This Many To Many In Staff Role?

there is three tables in my relationships. and the tables are

staff table

id
first_name
last_name


role Table

id
role_name
is_staff_role bool
is_partner_role bool


sraff_role table

id
gallery_id FK
staff_id  FK
role_id Fk
role_start_date date
role_end_date date Nullable

as you can see staff_role table is pivot table, so how can i insert gallery_id foreign key which has one to many relationship with galleries table.

and also role_start_date and role_end_date

i heard about that pivot tables can be made with models. so is that the appropriate way for this pivot table?

Feb
22
3 months ago
Activity icon

Replied to ErrorException (E_NOTICE) Compact(): Undefined Variable: Image

i have the same problem with the same code. in update method where should i put that code?

Jan
29
4 months ago
Activity icon

Replied to Set CSS Script For Specific Laravel Page

you can add styles and scripts you want to use for all the pages in the layout then push extra styles or scripts needed by view template as mentioned above by @tykus

Jan
13
4 months ago
Activity icon

Started a new Conversation Laravel Blade How To Concatenate Youtube Iframe Youtube Id From Database In Blade

i want to concatenate in blade youtube iframe with a video id. but it is not working .

	<iframe width="580" height="360" src='https://www.youtube.com/embed/{{$movie['QRfj1VCg16Y']}}'> 
       </iframe>

but undefined index error is showing up.