Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to pass data to controller in laravel

$dept = DB::table('master_department')->get();
$design = DB::table('master_designation')->get();
return view('registration', ['dept' => $dept], compact('design'));

#if we send as array
@foreach($dept as $key=>$d)
	{{ $dept[$key]->dept_title }}
@endforeach

#if we send as compact object
@foreach($design as $deg)
	<option value="{{ $deg->id }}">{{ $deg->deg_title }}</option>							
@endforeach
Comment

PREVIOUS NEXT
Code Example
Php :: laravel collection to json 
Php :: laravel set date format 
Php :: laravel import csv to database 
Php :: php extract number from string without comma 
Php :: how to run a php file in xampp 
Php :: Creating (Declaring) PHP Variables 
Php :: wp_query first post 
Php :: spaceship operator 
Php :: php preg replace 
Php :: PHP strip_tags — Strip HTML and PHP tags from a string 
Php :: laravel middleware 
Php :: convert collection to array laravel 
Php :: add footer code 
Php :: ternary in php 
Php :: composer install phpWord 
Php :: PHP Ternary Operator With Elseif Example 
Php :: rollback to previous php version in linux 
Php :: laravel resource 
Php :: laravel check if primary key exists 
Php :: how to add two string in php 
Php :: delay queue laravel 
Php :: Get data from array (from an API) in Laravel 
Php :: how change resource route parameters lravel 
Php :: how check the time of operation in laravel 
Php :: find diiference in minutes un laravel 
Php :: wp php blog info image 
Php :: php order array 
Php :: symfony request type 
Php :: php howto ignore file with BOM 
Php :: err_cache_miss php 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =