ajithlal

ajithlal

Web developer at Ernakulam

Member Since 8 Months Ago

Experience Points
13,110
Total
Experience

1,890 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
70
Lessons
Completed
Best Reply Awards
8
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 3
13,110 XP
Sep
30
2 weeks ago
Activity icon

Replied to Converting Coding

It should be in the value part. value="restock[0][quantity]

Sep
24
3 weeks ago
Activity icon

Replied to Validation Rule "Sometimes" Not Working As Expected

@nakov from your answer I've updated the rules like this

if ($this->method() == "POST") {
            $rules['password'] = 'required|string|min:8|confirmed';
        }

and it works fine.

Activity icon

Replied to Validation Rule "Sometimes" Not Working As Expected

@edoc can't use nullable. because i want to use required when inserting the data to the table.

Activity icon

Replied to Validation Rule "Sometimes" Not Working As Expected

@munazzil I tried this way. but not working as expected.

Activity icon

Replied to Validation Rule "Sometimes" Not Working As Expected

@nakov I wrote my validation rule like this

'password'          => 'present|string|min:8|confirmed',

still not working as expected.

Activity icon

Replied to Validation Rule "Sometimes" Not Working As Expected

@munazzil I've used required validation referring this link https://laravel.com/docs/5.8/validation#conditionally-adding-rules.

I've tried the way you mentioned. but it also not working as I expected.

Activity icon

Replied to Validation Rule "Sometimes" Not Working As Expected

@nakov I've tried. but its showing the password field as required.

Activity icon

Replied to Validation Rule "Sometimes" Not Working As Expected

@nakov I don't want to validate the password field if the empty.

Activity icon

Started a new conversation Validation Rule "Sometimes" Not Working As Expected

I've a form with password field. So i've added the validation rule sometimes to validate only if the password field is not empty. But it is not working as expected. here is my code.

public function rules()
    {
        $rules = [
            ......
        'password'          => 'sometimes|required|string|min:8|confirmed',
            .....
        ];

        return $rules;
    }
Sep
16
1 month ago
Activity icon

Replied to Bootstrap 4 Scroll Spy Not Working

Maybe you are missing fixed-top class for navbar. add fixed-top class to nav tag. refer this link or this link

hope this will work for you.

Aug
14
2 months ago
Aug
09
2 months ago
Activity icon

Replied to Mail Send Working In Localhost Getting Error On Godaddy Server

if you are using gmail then change your MAIL_HOST to MAIL_HOST=smtp.gmail.com

Activity icon

Replied to "Class 'App\Http\Controllers\test' Not Found" Please Check My Code Where I Going Wrong?

you are not included test model. please include model test to your controller

Aug
08
2 months ago
Activity icon

Replied to How Can I Use Two Different Template For Same Route In Laravel

you can use @guest I think. I'm not sure it is a best practice or not.

Activity icon

Replied to Update Status Field Value While Soft Deleting A Record

@click the deleted_at is populated after i run the code. but the status is not changing. So i do the status changing in deleting event.

I've solved it already.

thanks for your support :)

Aug
07
2 months ago
Activity icon

Replied to Update Status Field Value While Soft Deleting A Record

Thanks. That has been fixed by overriding the boot method like this.

public static function boot()
    {
        parent::boot();
        self::deleting(function ($model) {
            $model->status = static::STATUS_DELETED;
            $model->save();
        });
    }
Activity icon

Started a new conversation Update Status Field Value While Soft Deleting A Record

Hi,

I'm using softDelete to delete a record. I want to update my status field value before soft deleting the record. Here is my delete code.

public function destroy($id)
    {
        try {
            $booking = Booking::findOrFail($id);
            $booking->status = Booking::STATUS_DELETED;
            if ($booking->save()) {
                $booking->delete();
            }

            return redirect()->route('bookings.booking.index')
                ->with('success_message', trans('bookings.model_was_deleted'));
        } catch (Exception $exception) {
            return back()->withInput()
                ->withErrors(['unexpected_error' => trans('bookings.unexpected_error')]);
        }
    }

but the status is not changing

Activity icon

Replied to Create New Item

the above error states that, you have two parameters on your controller and you are passing nothing. if you are submitting a form then pass the book id as hidden input. not as parameter

Aug
06
2 months ago
Activity icon

Replied to Create New Item

can you be more precise. from where you are creating book item what is your exact criteria?

if you have a route() for creating book item from book index like route('book.item.create') then pass id of the book through the URL like

route('book.item.create',$book->id)

then on route.php write

Route::get('book/item/{$id}','[email protected]')->name('book.item.create');

then on your controller you can pass the booking id to form

........
........
ExampleController extends Controller
{
//your other functions
    public function create($id)
    {
        return view('booking.item',compact('id'));
    }
//your other functions
}
Activity icon

Replied to Create New Item

pass book_id as hidden field in form

Activity icon

Replied to Create New Item

if can pass the book_id as hidden variable

Activity icon

Replied to Create New Item

you can pass the $book->id as a variable in your route() like route('route.name',{id of the book}). Then find the book model/object using the book_id.

$book = BookModel::findOrFail($book_id);
Activity icon

Replied to Checking For Null Values In A User Object

@nakov understood. as I'm new to laravel i'm not familiar with this kind of code. that's why I asked the above question. If your method of code execution is more effective then, one who visit the discussion can also use the same. :)

Activity icon

Replied to Checking For Null Values In A User Object

@nakov what will be the benefit of doing this over simple if condition?

Activity icon

Replied to Checking For Null Values In A User Object

if else ladder? or using OR condition in single if

Activity icon

Replied to Checking For Null Values In A User Object

check is_null($user->sex) || is_null($user->phone) like this.

Activity icon

Replied to Session Getting Destroyed After Payment Gateway Redirecting To Success Callback Url.

maybe you can store the value to db before requesting payment to paypal and update the payment status and other fields that can be filled after successful payment. if the payment fails then you can delete the current entry from db or can keep the entry with payment_status=failed. for future reference.

I hope this will help you

Activity icon

Replied to Session Getting Destroyed After Payment Gateway Redirecting To Success Callback Url.

make 'expire_on_close' => false, and increment the session lifetime and try

Activity icon

Replied to Session Getting Destroyed After Payment Gateway Redirecting To Success Callback Url.

check your session configuration inconfig.session.phpfile

Activity icon

Started a new conversation Adding Data To Database One Field Doesn't Accepting Value From Request Class

While I'm creating a new entry to my database only one field not accepting value from Request class.

$booking = Booking::create([
                'user_id'              => $request->user_id,
                'event_id'             => $request->event_id,
                'hall_id'              => $request->hall_id,
                'package_id'           => $request->package_id,
            ]);

Here event_id not accepting the value from $request->event_id. When I dd() the $request it having the value. dd($request) output

"user_id" => "1"
"event_id" => "5"
 "hall_id" => "5"
 "package_id" => "1"

What i'm missing?

Jul
26
2 months ago
Activity icon

Replied to SSL Error

check with this .htaccess

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Jul
25
2 months ago
Activity icon

Replied to Why Is_active On MarkEmailAsVerified() Not Being Saved? (5.8)

probabily is_active type. please check the type

Jul
23
2 months ago
Activity icon

Replied to Call To A Member Function AddEagerConstraints() On Null

please check the foreign key is correct on account_type function

public function account_type(){

        $this->hasOne('App\AccountType', 'f_account_type');

    }
Activity icon

Replied to Routing With Localization In Laravel

update the controller like below and check

public function show(Blog $blog)
{
    return view('blogs.show', compact('blog'));
}
Activity icon

Replied to Call To A Member Function AddEagerConstraints() On Null

This error usually occurs when we are trying to call a function that can be accessed via model and accessing with empty results.

dump your results and check you are calling the method addEagerConstraints() from a null value

Activity icon

Replied to SQL Cannot Add Forign Key

can you check the user table migration and id type. (like: increments or bigIncrements).

if its bigIncrements then change the owner_id field to bigInteger and check

Activity icon

Replied to SQL Cannot Add Forign Key

write the migration like the blow

public function up()
    { 
        Schema::create('projects', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('owner_id')->unsigned();
            $table->string('title');
            $table->text('description');
            $table->timestamps();

       $table->foreign('owner_id')
                  ->references('id')
                  ->on('users')
                  ->onDelete('cascade');
       });
    }

if you have already run the migration then do php artisan migrate:fresh

Note: by running the above command all current tables on db will be dropped.

Jul
22
2 months ago
Activity icon

Replied to Wrong URL

<VirtualHost *:80>
     ServerAdmin [email protected]
     ServerName syworkx.public 
     DocumentRoot "C:/xampp/htdocs/syworkx/public/"
     <Directory "C:/xampp/htdocs/syworkx/public/">
         DirectoryIndex index.php
     </Directory>
 </VirtualHost>

can you rewrite it and check?

Activity icon

Replied to The GET Method Is Not Supported For This Route. Supported Methods: POST.

use method post on ajax request and remove datatype from ajax request

Activity icon

Replied to The GET Method Is Not Supported For This Route. Supported Methods: POST.

did you comment the datatype property and check.

Activity icon

Replied to The GET Method Is Not Supported For This Route. Supported Methods: POST.

change the method used in ajax function to post. and comment the data type property.

Activity icon

Replied to Wrong URL

check your virtual host configuration.

Jun
25
3 months ago
Activity icon

Started a new conversation Session Not Returning The Saved Data On Page Refresh

I'm using session to store some data. I've a session named searchData, that is an array. it is having values

Array ( [Event] => 5 [Hall] => 5 [Date] => 2019-06-25 [Time] => Array ( [0] => Day ) )

I'm trying to add another array of values into the existing array, after adding the values it is returning the new values inside the array like below

[searchData] => Array
                (
                    [event] => 5
                    [hall] => 5
                    [date] => 2019-06-25
                    [time] => Array
                        (
                            [0] => day
                        )

                    [package_id] => 1
                    [price] => 6300
                    [advance] => 3000
                    [selectedPrice] => 3000
                    [add-on] => Array
                        (
                            [5-id] => 5
                            [5-price] => 100.0000
                            [5-count] => 1
                        )

                )

when I refresh the page and print the values in session the newly added array is not showing.

Here is the code used for adding the array of values to existing session.

    $request->session()->put("searchData.add-on.{$addOn->id}-id", $addOn->id);
        $request->session()->put("searchData.add-on.{$addOn->id}-price", $addOn->price);
        $request->session()->put("searchData.add-on.{$addOn->id}-count", $request->count);

in my config/session.php i've changed the below section

'expire_on_close' => true,
Jun
21
3 months ago
Activity icon

Replied to Hello I Want To Upload Image On My Laravel Project , So When I Submit The Request I Get Error Message Under The Image

Sorry your question is not clear. I think you forget to include the enctype on form tag. Please add enctype="multipart/form-data" in your form tag.

Hope this will help.