Laravel 6 – whereHasMorph Relationship Return Empty

I’m new to laravel Polymorphic Relationship. i have 2 table Supplier and Product and have Category to each table, so i’m decide to use Polymorphic Relationship. i want to query supplier-category but its return empty array. // My Category Model class Category extends Model { protected $fillable = [‘categorizable_type’, ‘categorizable_id’]; public function categorizable() { return…

Undefined variable: in laravel 6

I am trying to Display data on Laravel view page from database. but it shows nothing to me this is the code on .blade.php file:- <tbody> @if(isset($Us)) @foreach($Us as $row) <tr> <td></td> <td></td> <td></td> </tr> @endforeach @endif </tbody> </table> Code on AdminController.php: public function index() { $Us = users::all()->toArray(); return view(‘master’)->with([‘Us’=> $Us]); } and on…

How to save multiple lines of dynamic table in Laravel

I have a table inside a form, where the user can add/remove the rows the output of. $data = $request->all(); dd($data); StoreController public function store(Request $request) { $request->validate([ ‘supplier_name’ => ‘required’, ‘transaction_in_date’ => ‘required|before_or_equal:today’, ‘device_type_name’ => ‘required’, ‘device_brand_name’ => ‘required’, ‘device_spec’ => ‘required|max:255’, ‘price’ => ‘required’, ‘amount’ => ‘required’, ‘total_price’ => ‘required’, ‘keterangan’ => ‘Nullable’,…

How to configure a route of extracting data from the same table in laravel

I have a show method which is showing animals from a specific farm. I wanted to add another option of the element of the same farm but with a specific condition, for instance age <= 2. This is what I have tried so far routes(vaccine1) Route::get(‘/clinic/{animal}/create’, ‘ClinicController@create’); Route::post(‘/clinic/{animal}’, ‘ClinicController@store’); Route::get(‘/clinic/{animal}/{clinic}/edit’, ‘ClinicController@edit’); Route::get(‘/clinic/{farm}’, ‘ClinicController@show’); Route::get(‘/clinic/{farm}’, ‘ClinicController@vaccine1’)->name(‘vaccine1’);…