Skip to content

Tag: laravel

Laravel 5.6.9 – database count gives different outputs

Does anyone know why these two ways to count numbers of users in my table give different answers when i run them in tinker? AppModelsUser::count() => 92269 $count = DB::table(‘users’)->count() => 92829 Running a SQL query in Sequel Pro gives 92829. Answer If you have the SoftDelete trait …

Get a value from two tables

I am trying to get the value of the colum “name” from the clubs table. First table:(Clubs) id* name (what i need!!!) email password Second table:(club_posts) id club_id* zip_id kategory type stadt plz Controller: This is my query: The result is an array with ten values, but need only one. Answer C…

Multiple LIKE clauses in Laravel Eloquent

I currently have this code in my controller: The above code works, but what I want is to get “Accounting” and “Web Design” from an array, and just loop through that array so that the query is dynamic instead of hard coded on the controller Answer Try this :