Support the ongoing development of Laravel.io →
Database Blade Forms
Last updated 2 years ago.
0

Gallery properties $fillable in model ?

0

Here is the Gallery.php model

<?php

class Gallery extends \Eloquent {
	protected $fillable = array('title', 'content', 'image');
    protected $guarded = array('id');

    protected $table = 'gallery';

    public static $rules = array(
        'title' => '',
        'content' => '',
        'image' => ''
    );
}
0

Describe "everything except for the image has been posted" . Try PUT instead of PATCH. What fields are not updating (i assume by updating you mean saving to database, right ?) and what fields are updated via your code ?

0

I tried PUT but still nothing. In my edit.blade.php I have these fields:

title content image

title and content is being posted with the changes that was made but image has a blank to it so it looks like this

Array
(
    [_method] => PUT
    [_token] => AuY9NBP5MkfX0mNCBnwt1QKViI01cl9F5bWnGkYc
    [title] => test 33
    [content] => 
test


    [image] => 
)

and yes I'm saving to the database. And the only things that get updated is my title and content

0

If your application is in $debug = true; mode you can see the sql update query via debug console down-left laravel icon on the rendered view (browser). Paste it here. What type of data is your database column 'image' ?

Last updated 9 years ago.
0

My application does have 'debug' => true, but I don't see the query anywhere or the laravel icon. My image column is a varchar in my database.

0

Any ideas as to how I can get the images to update?

0

any help?

0

I can't really tell what all the ajax stuff is doing, but I did notice two things. First, there is a {{ Form::open() }} tag at the bottom of your form instead of {{ Form::close() }}. Also, you might need to set the files option to true in order to set the form's enctype attribute to multipart/form-data.

{{ Form::model($galleries, array('files' => 'true', 'method' => 'PATCH', 'route' => array('admin.gallery.update', $galleries->id))) }}

Maybe fill me in a bit more on the AJAX stuff? After the updates, if you die and dump the input in the controller what do you see?

dd($input);
0

When I put

dd($input)

I get

array (size=5)
  '_method' => string 'PATCH' (length=5)
  '_token' => string 'cOOg56pbcKJ3BDgsQWL6MGxK4CO1SXdGRq8rd1rV' (length=40)
  'title' => string 'test' (length=4)
  'content' => string '<p>test</p>' (length=11)
  'image' => string '' (length=0)

In a nutshell, the ajax is suppose to find the class test-upload and get the image and push it through to the POST section.
I hope that makes sense

Last updated 9 years ago.
0

Any Ideas?

0

I think your form don't have enctype="multipart/form-data"

0

I added

'files' => 'true

to my form and it still didn't work.

0

It's an issue with the ajax stuff for sure. I don't know what plugin that is and it's really hard to help without seeing more. Sorry! Seems sort of complicated though? Maybe try to simplify your UI if you can. Use one form for the gallery title, description, etc. Use another form for the file uploads, and then have remove buttons for each image.

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

shiva shiva Joined 24 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.