Category : phpmyadmin

I have 3 tables: users id role email typable_id typable_type buyers id name address avatar email residential_id residentials id name city state And here is my model that shows the relationship User.php public function typable() { return $this->morphTo(); } Buyer.php public function residential() { return $this->belongsTo(Residential::class); } public function user() { return $this->morphMany(User::class, ‘typable’); } ..

Read more

I have a database set-up like this: https://imgur.com/a/ECOypAE My code is this public function index(Sponsorship $sponsorship) { //definisco la data di scadenza con CARBON $current_timestamp = Carbon::now(‘Europe/Rome’)->toDateTimeString(); //recupero la sponsorizzazione in database piĆ¹ recente, dell’appartamento in oggetto $apartment = Apartment::all()->where("id","=", $sponsorship->apartment_id)->where("expiry_date", ">", $current_timestamp); dd($apartment); What i want to do is show only the apartments where ..

Read more

Everything was good till yesterday. I added a new column for address in the user table yesterday & since today morning i am unable to login to the server using the credentials. This is the error that i see from laravel.log : [2020-08-21 12:32:37] development.ERROR: Trying to get property ‘name’ of non-object (View: /home2/myproject/public_html/shopnow/resources/views/settings/users/profile.blade.php) {"userId":51,"exception":"[object] ..

Read more

in my code,i want to show category and sub catagory under the Category in the Products table. Here is my categories table 1. public function up() { Schema::create(‘categories’, function (Blueprint $table) { $table->increments(‘id’); $table->integer(‘parent_id’); //sub category id $table->string(‘name’); $table->rememberToken(); $table->timestamps(); }); } Here is my products table 2. public function up() { Schema::create(‘products’, function (Blueprint ..

Read more

Can anyone please help me for setting the correct foreach loop for sending multiple input values to the database(Phpmyadmin), Whenever I execute this code in postman only one entry gets uploaded in the database. I want to send multiple “user_id” at once. $input = json_decode(file_get_contents(‘php://input’, true)); foreach($input->users as $user) { $groupId = $user->group_id; $groups = ..

Read more