Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jamalroger's avatar

Laravel 6 : data inserting into db when i deploy projet on apache2 not working

hello , when i have use artisan command data is inserting but when i deploy project on Apache record did not inserting into database . the problem there no errors is showing laravel show success , i have already test mysql connectioon auto commit is set to 1 but not work

any idea ??

0 likes
5 replies
jlrdw's avatar

Can you show the code (formatted properly) that is giving you trouble.

jamalroger's avatar

@jlrdw thanks for reply


$user = User::create([
            'username' => $request->username,
            'password' => Hash::make($request->password),
            'email' => $request->email,
            'role_id' => Role::where('slug', 'employee')->first()->id
        ]);

        $user->profile()->save(new Profile([
            'first_name' => $request->first_name,
            'last_name' => $request->last_name,
            'post' => $request->post,
            'salary' => $request->salary,
            'reste_leave' => $request->leave
        ]));

select,delete eloquent methods is worked but create,update,save,attach not working

jlrdw's avatar
jlrdw
Best Answer
Level 75

Was you using tinker. And go over https://laravel.com/docs/7.x/eloquent#mass-assignment and make sure your model is set up correctly.

In development was you on Windows, if so remember linux is case sensitive.

SomeClass equals someclass in Windows.

SomeClass does not equal someclass in Linux.

Check other logs, like apache log also.

Use your browser developer tools to help troubleshoot.

1 like
jamalroger's avatar

@jlrdw thanks for your advise it was Problem 1 : laravel http 301 Moved Permanently when i send post request i find a solution

in public/.htaccess file change the redirect trailing status from 301 to 307

# Redirect Trailing Slashes If Not A Folder…
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)/$ / [L,R=307]

Please or to participate in this conversation.