0% found this document useful (0 votes)
7 views

Laravel Part-8

Uploaded by

waver58650
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Laravel Part-8

Uploaded by

waver58650
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Video-26 (How to add Bootstrap in Laravel):-

-----------------------------------------------------------
There are three ways to add bootstrap in our file : -
a. Using CDN
b. Inside Public folder
c. Inside resources folder

Inside resources folder


a. When your css and js file to compile then you use your css
and js file inside the resources folder.
b. Iske le kuch requirement hota hai : -
1. Install Node : - https://nodejs.org/en/
2. Install Laravel Mix using npm : - The required dependency
is already mention in package.json file so just run npm install
and laravel mix will automatically get installed.
3. Install Bootstrap and Popper JS
npm install --save-dev bootstrap@next
npm install --save-dev @popper/core
4. Create a folder named sass inside resources folder then thsen
create
a file named app.scss resources/sass/app.scss
5. Open app.scss file then write
@import ‘~bootstrap/scss/bootstrap’;
6. Open resources/js/bootstrap.js file then write
import (‘bootstrap’);
7. Open webpack.mix.js file and mentioned created scss and js files,
later it will be processed.
Example:-
mix.js(‘resources/js/app.js’, ‘public/js’ )
.scss(‘resources/scss/app.css’,’public/css’)
.postCss(‘resources/css/style.css’,’public/css’)
.js(‘resources/js/myscript.js,’public/js)

8. Now, run the command npm run dev, This command will
run all mix tasks and all of your application’s CSS and JS
assets will be compiled and placed in your application’s
public directory (Non-minified code).
OR

Now, run the command npm run prod, This command will
run all mix tasks and all of your application’s CSS and JS
assets will be compiled and placed in your application’s
public directory (minified code).
OR

Then run npm run watch, command which will continue


running in your terminal and watch all relevant CSS and JS
file for changes.Webpack will automatically recompile your
assets when it detects a change to one of those files.

Video-27 (Named Route in Laravel):-


--------------------------------------------------
1. Named routes allow the convenient generation of URLs or redirects for
specific routes.You may specify a name for a route by chaining the
name method onto the route definition:
// blade page
Route::get(‘home-page',function(){
return view(('home'));
})->name(home);

Route::get('about-page',function(){
return view(('aboutme'));
})->name('about');

// Controller page
Route::get(contact,[ContactController::class,'show'])->name(
'contact-us');

2. Once your have assigned a name to a given route, you may use the
route's name when generating URLs or redirects via Laravel's route
and redirect helper functions:
Example: -
route(‘abt’)
redirect() -> route(‘abt’)

{{-- Using route helper function --}}


<ul>
<li><a href="{{route('home')}}">Home</a></li>
<li><a href="{{route('abt')}}">About</a></li>
<li><a href="{{route('contact-us')}}">About</a></li>
</ul>
3. if the named route defines parameters, you may pass the parameters
as the second argument to the route function. The given parameters
will automatically be inserted into the generated URL in their correct
positions:
Route::get('/user/{id}/profile', function ($id) {
//
})->name('profile');
$url = route('profile', ['id' => 1]);

4. If you pass additional parameters in the array, those key / value pairs
will automatically be added to the generated URL's query string:
Route::get('/user/{id}/profile', function ($id) {
//
})->name('profile');
$url = route('profile', ['id' => 1, 'photos' => 'yes']);
// /user/1/profile?photos=yes

Video-28 (Resumed Laravel Project):-


--------------------------------------------------

You might also like