Flex

Flex

Member Since 2 Years Ago

Experience Points 11,290
Experience Level 3

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

17 Jul
2 days ago

Flex started a new conversation Method Illuminate\Mail\Mailer::from Does Not Exist.

I am using Laravel 5.7 and using the following logic to sending emails in My Methods,

Mail::from('ABC');
Mail::to($user->email)->send(new VerifyMail($user));

but I got following error message BadMethodCallException Method Illuminate\Mail\Mailer::from does not exist.

how can I fix this problem? I need mark as ABC sender

Thanks.

Flex started a new conversation How To Change Email In Laravel App?

I am working with Laravel 5.7 and I have configured my .env file using gmail as following to send emails

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=********
MAIL_ENCRYPTION=tls

but now I need change above email address and update my settings as following

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=********
MAIL_ENCRYPTION=tls

but my problem is this after I changed .env settings to the second email address it is sending emails as My first email address(mymail11@gmail.com) how could happen it? and how could I change My second email address as My default email in Laravel App?

Thanks.

31 May
1 month ago

Flex started a new conversation How To Fix Duplicate Entry Error In Laravel 5.7?

I am using a user verification system in email with Laravel 5.7 this is working fine. my Usercontroller is as following,

<?php

namespace App\Http\Controllers;
use App\Mail\VerifyMail;
use App\User;
use App\VerifyUser;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;

class UserController extends Controller
{
        protected function store(Request $request)
    {

        $user = new User;

        $user->email = $request->input('email');
        $user->name = $request->input('name');
        $user->address = $request->input('address');
        
        $user->save();

        $verifyUser = VerifyUser::create([
            'user_id' => $user->id,
            'token' => str_random(40)
        ]);

        Mail::to($user->email)->send(new VerifyMail($user));

       return redirect()->back()->with('info','We sent you an activation code. Check your email and click on the link to verify');
    }

    public function verifyUser($token)
    {
        $verifyUser = VerifyUser::where('token', $token)->first();
        if(isset($verifyUser) ){
            $user = $verifyUser->user;
            if(!$user->verified) {
                $verifyUser->user->verified = 1;
                $verifyUser->user->save();
                // Mail::to('[email protected]');
                $info = "Your e-mail is verified. You can now login.";
            }else{
                $info = "Your e-mail is already verified. You can now login.";
            }
        }else{
             return redirect()->back()->with('warning', "Sorry your email cannot be identified.");
        }

         return redirect()->back()->with('info', $info);
    }
}

but when I tried to enter the same email with verification form it is generating following massages SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '[email protected]' for key 'users_email_unique' (SQL: insert intousers(email,name,address,updated_at,created_at) values ([email protected], Banda, Sysney, 2019-05-31 11:32:36, 2019-05-31 11:32:36))

how can I fix this problem?

17 May
2 months ago

Flex left a reply on Not Working Laravel And Ajax Data Insert In To The Database

@snapey Thanks, yes you are correct it was jquery not loaded

16 May
2 months ago

Flex left a reply on Not Working Laravel And Ajax Data Insert In To The Database

No, any ideas to solve this problem?

Flex left a reply on Not Working Laravel And Ajax Data Insert In To The Database

@devfrey ReferenceError: $ is not defined[Learn More] localhost:8000:174:1 <anonymous> http://localhost:8000/:174

Flex started a new conversation Not Working Laravel And Ajax Data Insert In To The Database

working with Laravel 5.7 and Ajax to insert data and display in the following blade file,

<table border="0">
    <th colspan="6">Members</th>
    <tr>
    <td>Id</td>
    <td>Name</td>
    <td>Email</td>
    <td>Address</td>
    </tr>

    @foreach($member as $value)
    <tr>
    <td>{{$value->id}}</td>
    <td>{{$value->name}}</td>
    <td>{{$value->age}}</td>
    <td>{{$value->email}}</td>
    <td>{{$value->address}}</td>
    </tr>
    @endforeach
    </table>

    <!--insert data-->
    <table border="0">
    <th colspan="2">Insert</th>
    <tr>
    <td>Name:</td>
    <td><input type="text" name="name"></td>
    </tr>

    <tr>
    <td>Age:</td>
    <td><input type="text" name="age"></td>
    </tr>

    <tr>
    <td>Email:</td>
    <td><input type="text" name="email"></td>
    </tr>

    <tr>
    <td>Address:</td>
    <td><input type="text" name="address"></td>
    </tr>

    <tr>
    <td colspan="2"><button type="submit" id="insert">Insert</button></td>
    </tr>
    </table>
    {{ csrf_field() }}

$('#insert').click(function(){
    $.ajax({
        type:'post',
        url:'insertdata',
        data:{
            '_token':$('input[name:_token').val(),
            'name':$('input[name:name').val(),
            'age':$('input[name:age').val(),
            'email':$('input[name:email').val(),
            'address':$('input[name:address').val(),
        },
        success:function(data){
            window.location.reload();
        },
    });
});

My HomeController is like this,

public function index()
    {
        $member = membersmodel::all();
        return view('home.index')->with('member',$member);
    }

    public function insertdata(Request $request)
    {
        $member = New membersmodel();
        $member->name = $request->name;
        $member->age = $request->age;
        $member->email = $request->email;
        $member->address = $request->address;
        $member->save();
        return response()->json($member);
    }

and route is,

Route::get('/','[email protected]');

Route::post('insertdata','[email protected]');

but when I insert data in the insert table and click insert button, anything not happens. not saving data or displaying. No, any error occurred.how can fix this problem?

09 May
2 months ago

Flex started a new conversation Not Working Php Artisan Db:seed?

create following seed files, UserTableSeeds.php

<?php

use Illuminate\Database\Seeder;
use App\User;

class UserTablesSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        User::create([
        'name' => 'Nalaka',
        'email' => '[email protected]',
        'password' => Hash::make('password'),
        'remember_token' => str_random(10),
        ]);
    }
}

DatabaseSeeder.php

<?php

use Illuminate\Database\Seeder;


class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        // $this->call(UsersTableSeeder::class);
        Eloquent::unguard();
        $this->call('UserTableSeeder');
    }
}

and run following command, php artisan db:seed

but got following error in my cmd reflection exception class userstableseeder does not exist

how can fix this problem?

02 May
2 months ago

Flex started a new conversation Not Working Laravel + Vuejs In Laravel App

working with Laravel 5.7 and Vue Js. this is app.js

let Myheader = require('./components/Myheader.vue');
let Myfooter = require('./components/Myfooter.vue');

const app = new Vue({
    el: '#app',
    components:{Myheader,Myfooter}
});

blade.php file

<body>
<div id="app">
<Myheader></Myheader>
<Myfooter></Myfooter>
</div>
<script src="{{ asset('js/app.js')}}"></script>  
</body>

but when I run npm run watch command it is not displayed vue component. how can fix this problem?

my console output is,

[Vue warn]: Failed to mount component: template or render function not defined. found in ---> <Myfooter> <Root>

how can fix this problem?

24 Mar
3 months ago

Flex started a new conversation What Is Laravel Repository Design Patten?

can you anybody explain simply what is laravel repository design pattern?

18 Mar
4 months ago

Flex started a new conversation How To Customize Laravel Auth Login And Registration System?

I am using Laravel 5.7 and hope to use Auth command to create Login and Registration system. but by default with Auth command laravel make register system and login with email field. but this time in my case I do not need email and I need NIC field with registration and login system. in laravel documentation there is Username Customization but I can not understand that. any body can explain simple step to customize Auth command username to NIC.

Thanks.

17 Mar
4 months ago

Flex left a reply on Not Loading Vue File In Laravel 5.7 Application

@malakhaltsev I thing I have done all correctly but not working

Flex started a new conversation Not Loading Vue File In Laravel 5.7 Application

working with laravel 5.7 and vue.js my app.js file is as following,

require('./bootstrap');
window.Vue = require('vue');
import VueRouter from 'vue-router'
Vue.use(VueRouter)

let routes = [
    { path: '/dashboard', component: require('./components/Dashboard.vue') },
    { path: '/profile', component: require('./components/Profile.vue') }
  ]

  const router = new VueRouter({
    routes // short for `routes: routes`
  })
Vue.component('example-component', require('./components/ExampleComponent.vue').default);
const app = new Vue({
    el: '#app',
    router
});

and I need link following link with vue file

<router-link to="/dashboard" class="nav-link">

and Dashboard.vue file is like this

<template>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card card-default">
                    <div class="card-header">Dashboard Component</div>

                    <div class="card-body">
                        I'm an example component.
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        mounted() {
            console.log('Component mounted.')
        }
    }
</script>

but when I click above link to dashbord.vue file it is not loading. only display url in the address bar. my console error is as following [Vue warn]: Failed to mount component: template or render function not defined. found in --->

how can fix this error

13 Mar
4 months ago

Flex left a reply on Not Working Php Artisan Serve Command?

@diegoaurino did its but not success

Flex left a reply on Not Working Php Artisan Serve Command?

@gorakhyadav no any error on the command prompt

Flex left a reply on Not Working Php Artisan Serve Command?

@diegoaurino yes I have install php correctly. and My other laravel projects are working fine. this problem is only with this project.

Flex left a reply on Not Working Php Artisan Serve Command?

@snapey my laravel project name is api. and I have developing some api with laravel and above mentioned my api.php file in routes folder. not tinker command working same result.

Flex left a reply on Not Working Php Artisan Serve Command?

@munazzil my api.php is

<?php

use Illuminate\Http\Request;
Use App\Article;

Route::get('articles', function() {
    // If the Content-Type and Accept headers are set to 'application/json', 
    // this will return a JSON structure. This will be cleaned up later.
    return Article::all();
});
 
Route::get('articles/{id}', function($id) {
    return Article::find($id);
});

Route::post('articles', function(Request $request) {
    return Article::create($request->all);
});

Route::put('articles/{id}', function(Request $request, $id) {
    $article = Article::findOrFail($id);
    $article->update($request->all());

    return $article;
});

Route::delete('articles/{id}', function($id) {
    Article::find($id)->delete();

    return 204;
});

Route::get('articles', '[email protected]');
Route::get('articles/{article}', '[email protected]');
Route::post('articles', '[email protected]');
Route::put('articles/{article}', '[email protected]');
Route::delete('articles/{article}', '[email protected]');

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Flex left a reply on Not Working Php Artisan Serve Command?

@munazzil not success same result going back to project root

Flex started a new conversation Not Working Php Artisan Serve Command?

I am working with laravel 5.7 and now I need start server with command php artisan serve in my terminal. but when I type abov command and enter my command prompt is going back to my project root like C:Users\soft\Desktop\laravel\api this was working fine but suddenly occured this problem. how can I fix this problem?

Thanks.

12 Mar
4 months ago

Flex started a new conversation What Is The Best Way To Send Email Administrator?

I have develop simple taxi reservation system using Laravel 5.7. it is working steps are as following,

1.customer make a reservation.

2.then customer should logged with the email and confirm the reservation by clicking email link.

3.then data table saved reservation information and make verify field as 1 from 0 to identify as verified customer. and other table saved generated token

now I need to send as an email with reservation customer information to admin when customer click conformation email link. I need simple method. what is best way queue or scheduler or any other method. I need validate if customer click again verification link to stop sending email again to admin.

23 Feb
4 months ago

Flex left a reply on Why Did Not Working Laravel Middleware CORS With Vue JS

@ejdelmonico this is My kernel.php

<?php

namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array
     */
    protected $middleware = [
        \App\Http\Middleware\CheckForMaintenanceMode::class,
        
        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
        \App\Http\Middleware\TrimStrings::class,
        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
        \App\Http\Middleware\TrustProxies::class,
        \Barryvdh\Cors\HandleCors::class,
        
            
    ];

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            // \Illuminate\Session\Middleware\AuthenticateSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],

        'api' => [
            'throttle:60,1',
            'bindings',
        ],
    ];

    /**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array
     */
    protected $routeMiddleware = [
        'auth' => \App\Http\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
        'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
        'can' => \Illuminate\Auth\Middleware\Authorize::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
        'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
        'cors' => \Barryvdh\Cors\HandleCors::class, 
    ];

    /**
     * The priority-sorted list of middleware.
     *
     * This forces non-global middleware to always be in the given order.
     *
     * @var array
     */
    protected $middlewarePriority = [
        \Illuminate\Session\Middleware\StartSession::class,
        \Illuminate\View\Middleware\ShareErrorsFromSession::class,
        \App\Http\Middleware\Authenticate::class,
        \Illuminate\Session\Middleware\AuthenticateSession::class,
        \Illuminate\Routing\Middleware\SubstituteBindings::class,
        \Illuminate\Auth\Middleware\Authorize::class,
    ];
}

is this correct?

15 Feb
5 months ago

Flex started a new conversation Why Did Not Working Laravel Middleware CORS With Vue JS

working with Laravel 5.7 as backend and Vue JS as frontend. so, I need send http request fron Vue to Laravel backend. so, I used Laravel CORS package to using github link as following https://github.com/barryvdh/laravel-cors but it is not sucess and (not pass data to table fron vue). and my console error is `Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:8000/api/addItem. (Reason: CORS request did not succeed).

how can fix this error?`

08 Feb
5 months ago
07 Feb
5 months ago

Flex started a new conversation What Are Commanly Used APIs With Laravel?

what are common using third party APIs with Laravel please mention there specific services also.

28 Jan
5 months ago

Flex started a new conversation Failed To Open Stream: No Such File Or Directory In PHP

working with plain php. and I have php files in My includes folder like this, newclass.int.php

<?php
class NewClass extends ParentClass {
    }
?>

parentclass.int.php

<?php

class ParentClass{
    public $name = "Hey There!";
}
?>

and index.php like this,

<?php
include 'includes/parentclass.int.php';
include 'includes/newclass.int.php';
$object = new NewClass;
?>


<html>
<head>
<title>oop php</title>
</head>
<body>
<?php
echo $object->name;
?>

</body>
</html>

but I got following error msg when running the server, include(includes/parentclass.int.php): failed to open stream: No such file or directory in C:\wamp64\www\ooptest\index.php on line 2

Warning: include(includes/newclass.int.php): failed to open stream: No such file or directory in C:\wamp64\www\ooptest\index.php on line 3

Fatal error: Uncaught Error: Class 'NewClass' not found in C:\wamp64\www\ooptest\index.php on line 4

Error: Class 'NewClass' not found in C:\wamp64\www\ooptest\index.php on line 4

19 Jan
6 months ago

Flex left a reply on How Can Print Data On Table Related To Login User?

@vilfago how can set one to one relationship? may I use relationship on both models Student and User

Flex left a reply on How Can Print Data On Table Related To Login User?

@vilfago No any error yes logged user filled his/her data

Flex started a new conversation How Can Print Data On Table Related To Login User?

Hi, I have following table like students


id  name  email                 telephone         user_id
 1  anne   [email protected]   07115550096         5

user_id is related to id of users table.

now I need print all name, email and telephone data witch related to login user id. I have following controller function for that

public function index()
    {
        $students = Student::personal()->get();
        return view('students.index')->withStudents($students);
    }

and Student Model

 public function scopePersonal($query)
{
     return $query->where('user_id', Auth::user()->id);
      
}

using above syntax I am printing data as following,

{{Auth::user()->name}}
{{Auth::user()->email}}
{{Auth::user()->telephone}}

but it is not printing telephone value

18 Jan
6 months ago

Flex left a reply on What Is RESTFUL API?

@hdsavani I did your tutorials. but when I test

GET, URL:http://localhost:8000/oauth/token

it is get following error msg There was an error connecting to GET,%20URL:http://localhost:8000/oauth/token.

what is the problem? may I should insert data to tables?

15 Jan
6 months ago

Flex left a reply on How To Add Laravel Project To Github?

I got this error please make sure you have correct access right

Flex left a reply on How To Add Laravel Project To Github?

@manelgavalda may I use cmd after install git?

Flex started a new conversation How To Add Laravel Project To Github?

I am very new to github. now I have created new account in github. then, Please guide me how can I add My Laravel project on new repository in github?

10 Jan
6 months ago

Flex started a new conversation What Are The Differents Between RESTful And SOAP Based Web Services?

what are the differents between RESTful and SOAP based web services? give some examples?

09 Jan
6 months ago

Flex left a reply on What Is RESTFUL API?

@sergiu17 @schemeza Then what is JWT and witch is relationship with restfull api and web services?

Flex started a new conversation What Is RESTFUL API?

hello, I need to understand what is restful api and , important of apis and some examples of restful api. and some body know good tutorials links how to develop restful apis using laravel please post links here.

Thanks.

22 Dec
6 months ago

Flex started a new conversation 1/1) BadMethodCallException Method [validator] Does Not Exist.

using laravel 5.6 and in my controller I have following code,

$input = $request->all();
        $validator = $this->validator($input);

        if ($validator->passes()){
            $booking = $this->create($input)->toArray();
            $booking['link'] = str_random(30);

            DB::table('activations')->insert(['id_user' => $booking['id'], 'token' => $booking['link']]);
            Mail::send('mail.activation', $booking, function($message) use ($booking) {
                $message->to($booking['email']);

                $message->subject('acxian.com - Activation Code');
            });

but when I try submit button following error is occurring,

1/1) BadMethodCallException

Method [validator] does not exist.

how can I fix this?

14 Dec
7 months ago

Flex started a new conversation How Can Count Table Column Unique Values In Laravel 5.6?

working with laravel 5.6 and mysql. I have following table name as projects

id  name    type  
1   tuna        bio
2   nhye    IT
3   hyuj        bio
4   tour        IT
5   ghyt        commerce

I need count type column values which are unique values. as an example in above table I need count values 3 because there are three different values like bio, IT and commerce. how can I do this?

04 Dec
7 months ago

Flex left a reply on Why Did Not Update Category Name And Image In Laravel?

@munazzil when I use route:list I can see only

App\Http\Controllers\[email protected]

with

GET|HEAD

Flex left a reply on Why Did Not Update Category Name And Image In Laravel?

@realrandyallen clear it but still not success here

03 Dec
7 months ago

Flex left a reply on Why Did Not Update Category Name And Image In Laravel?

@realrandyallen did it same thing here when I update some thing here my url will like this

http://localhost:8000/category/update/19?_method=put&description=boatmk&image=&remove=0    //boatmk is updated category name

Flex started a new conversation Why Did Not Update Category Name And Image In Laravel?

working with Laravel 5.6 and MySQL. I am going to update categoryname and image in my categories table using the following controller function?

public function update(Request $request, $id)
{

    if ($request->isMethod('get'))
        return view('categories.form', ['image' => Category::find($id)]);

    else {
        $rules = [
            'categoryname' => 'required',
        ];
        $this->validate($request, $rules);
        $image = Category::find($id);
        if ($request->hasFile('image')) {
            $dir = 'images/';
            if ($image->image != '' && File::exists($dir . $image->image))
                File::delete($dir . $image->image);
            $extension = strtolower($request->file('image')->getClientOriginalExtension());
            $fileName = str_random() . '.' . $extension;
            $request->file('image')->move($dir, $fileName);
            $image->categoryimage = $fileName;
        } elseif ($request->remove == 1 && File::exists('images/' . $image->image)) {
            File::delete('images/' . $image->post_image);
            $image->categoryimage = null;
        }
    }
    $image->categoryname = $request->description;
    $image->save();
    return redirect()->route('categories.index');
}

and route

Route::match(['get', 'put'], 'category/update/{id}', '[email protected]');

and edit form

@if(isset($image))
        <form method="PUT" action="http://localhost:8000/category/update/{{$image->id}}" enctype="multipart/form-data">

        <input type="hidden" name="_method" value="put">

<label for="description" class="col-form-label col-md-3 col-lg-2">Description</label>
                <div class="col-md-8">
                    <input class="form-control" autofocus placeholder="Description" name="description" type="text" id="description" value="{{ isset($image) ? $image->categoryname : '' }}">



 <label for="image" class="col-form-label col-md-3">Image</label>
                    <div class="col-md-5">
                        <img id="preview"
                             src="{{asset((isset($image) && $image->categoryimage!='')?'images/'.$image->categoryimage:'images/noimage.png')}}"
                             height="200px" width="200px"/>
                        <input class="form-control" style="display:none" name="image" type="file" id="image" name="_token" value="{{ csrf_token() }}">
                        <br/>
                        <a href="javascript:changeProfile();">Add Image</a> |
                        <a style="color: red" href="javascript:removeImage()">Remove</a>
                        <input type="hidden" style="display: none" value="0" name="remove" id="remove">

but when I try to update data it is not updating. only refresh to the same page. no, any error. how can I fix this problem?

Flex left a reply on Why Did Not Update Category Name And Image In Laravel?

can you any one tell me how can I put my $image variable id in my form action

http://localhost:8000/update/{id}