I have three Models. University, Professor and Student. They have some relations. University Model : <?php namespace AppModels; use IlluminateDatabaseEloquentModel; use AppModelsUser; class University extends Model { protected $fillable = [‘name’, ‘user_id’]; /** * Get the user that owns the university. */ public function owner() { return $this->belongsTo(User::class); } } Professor Model : <?php namespace ..

Read more

Is it possible to add validation if another validation passed for example I have the following validation rules return [ ‘name’ => [‘required’, ‘string’, ‘min:3’, ‘max:30’], ‘password’ => [‘required’, ‘min:6’], ‘photo’ => [‘imageable’], ‘business_uuid’ => [‘required’, ‘uuid’, ‘exists:businesses,uuid’], ]; and I would like if the business_uuid validation passed to add validation for the phone number ..

Read more

In laravel 8, i created a simple query builder. $myRestaurants = Restaurant::where(‘status’, ‘active’); $myRestaurants->where(‘id’, ‘>’, 3); $myRestaurants->where(‘color’, ‘red’); the result would be a IlluminateDatabaseEloquentBuilder like this: $myRestaurants = Restaurant::where(‘status’, ‘active’)->where(‘id’, ‘>’, 3)->where(‘color’, ‘red’); First, Laravel add this queries to $myRestaurants and I am not sure if this behavior is correct. By the way i want ..

Read more

I get this error when trying to build a container ( in Laravel 7 project): executor failed running [/bin/sh -c docker-php-ext-install pdo mbstring pdo_mysql]: exit code: 1 This is Dockerfile: FROM php:7.4 RUN apt-get update -y && apt-get install -y openssl zip unzip git RUN curl -sS https://getcomposer.org/installer | php — –install-dir=/usr/local/bin –filename=composer RUN docker-php-ext-install ..

Read more

Data is generated like so: $repResults[] = [ ‘label’ => (new CarbonCarbon($wbwResult->created_at))->isoFormat(‘DD-MM-YY’), ‘data’ => [ # datatype cast to int to prevent {!! xss !!} (int) $wbwResult->discipline_three, (int) $wbwResult->discipline_four, (int) $wbwResult->discipline_five, (int) $wbwResult->discipline_six, ] ]; I am then trying to output the data as a line chart: const ctx = document.getElementById(‘myChart’).getContext(‘2d’); const myChart = new ..

Read more

I am trying to follow the steps here https://github.com/TwilioDevEd/voice-javascript-sdk-quickstart-php/blob/main/quickstart.js I don’t know they Have changed the Javascript SDJ to 2.0 or something. I was familiar with the previous library but it is depreciated. Can someone help me to figure out what’s going on I don’t know why I am getting this error Attempting to call ..

Read more

I have an overview site with a filter canton on top. The user can filer for location and department. The code of the controller looks like this: public function index(Request $request) { $posts = Post::orderBy(‘titel’) ->get(); $standorts = Standort::get(); $abteilungs = Abteilung::get(); if ($request->filled(‘s’)) { $query = strtolower($request->get(‘s’)); $posts = $posts->filter(function ($post) use ($query) { ..

Read more

Schema::create(‘details’, function (Blueprint $table) { $table->unsignedBigInteger(‘details_id’); $table->unsignedBigInteger(‘book_id’); $table->string(‘author’, 255); $table->string(‘publisher’, 255); $table->integer(‘year’); $table->longText(‘description’); $table->foreign(‘book_id’)->references(‘book_id’)->on(‘books’)->onUpdate(‘cascade’)->onDelete(‘cascade’); $table->timestamps(); }); Schema::create(‘categories’, function (Blueprint $table) { $table->id(‘category_id’); $table->string(‘category_name’, 255); $table->timestamps(); }); Schema::create(‘books’, function (Blueprint $table) { $table->id(‘book_id’); $table->unsignedBigInteger(‘category_id’); $table->string(‘title’, 255); $table->foreign(‘category_id’)->references(‘category_id’)->on(‘categories’)->onUpdate(‘cascade’)->onDelete(‘cascade’); $table->timestamps(); }); I want to make these 3 tables. But I keep getting errno 150 which is incorrectly formed. ..

Read more

I have a small slider that switches the preview image to the main image. It works fine now blade.php <div class="custom-carousel-section"> <div class="custom-container"> <div class="custom-carousel"> @if(!empty($article_block_images)) @foreach($article_block_images as $article_block_image) <div class="custom-carousel__title"> @if($loop->first) <span>{{ $article_block_image->title }}</span> @endif </div> @endforeach @endif @if(!empty($article_block_images)) @foreach($article_block_images as $article_block_image) <div class="main-image"> @if($loop->first) <img src="{{ $article_block_image->main_image }}" alt="{{ $article_block_image->image_alt }}" title="{{ $article_block_image->image_title ..

Read more

I have multiple livewire components e.g. opd.patient-count, opd.visit-count, opd.checkup-count and so on. I would like to store these components name into database then call by user role. Anyway, It does not work once I tried as below. foreach … echo ‘<livewire:opd.patient-count />’; endforeach … Any advice or guidance on this would be greatly appreciated, Thanks. ..

Read more

i want to resize and crop the images when they are uploaded. My script works in local but recently i deployed it in heroku and doesn’t work this is my full script public function store(Request $request) { $data = $request->validate([ ‘title’ => ‘required|min:5’, ‘category’ => ‘required’, ‘preparation’ => ‘required’, ‘ingredients’ => ‘required’, ‘img’ => ‘required|image’ ..

Read more