Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with models & fillable with '_' #9

Open
spooksie opened this issue Oct 11, 2021 · 4 comments
Open

Problems with models & fillable with '_' #9

spooksie opened this issue Oct 11, 2021 · 4 comments

Comments

@spooksie
Copy link

I tried to install and work with this package and it throws a lot of errors.

inside the model (services_relation.php)
protected $fillable = ['am_cat_id','service_category'];

Problem 1:
The template wont work as its trying to render

public function render()
    {
        $model = Model::where('am_cat_id', 'like', '%'.$this->search.'%')->orWhere('service_category', 'like', '%'.$this->search.'%')->latest()->paginate($this->paginate);
        return view('livewire.services-relation', [
            'rows'=> $model
        ]);
    }

Which I fixed with

public function render()
    {
        $model = Model::where('am_cat_id', 'like', '%'.$this->search.'%')->orWhere('service_category', 'like', '%'.$this->search.'%')->latest()->paginate($this->paginate);
        return view('livewire.services_relation', [
            'rows'=> $model
        ]);
    }
@spooksie
Copy link
Author

Problem 2:
Inside the blade file

<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $row->am cat id}}</td>

<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $row->service category}}</td>

Its doing a regular whitespace instead of _

Hope this helps.

@spooksie
Copy link
Author

spooksie commented Oct 11, 2021

Problem 3:
Without timestamps

Inside my model I have

public $timestamps = false;

Error

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'created_at' in 'order clause' (SQL: select * from `services_relations` where `am_cat_id` like %% or `service_category` like %% order by `created_at` desc limit 10 offset 0)

@riteshsingh1
Copy link
Owner

Thanks,
It will be fixed in next release

@rabol
Copy link

rabol commented Nov 23, 2022

I have made a fork and corrected the issues with '_'
https://github.com/rabol/livewire-crud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants