Note Flashcards

1
Q

Validation

A

$request->validate([

Array=>required)]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

error recalling

A
@if($errors->any()){
@foreach($errors->all() as $error)
{{ $error }}
@endforeach
@endif
At
$request->validate([
    'title' => 'required|unique:posts|max:255',
    'v1\.0' => 'required',
]);

@error(‘title’)
<div class="alert alert-danger">{{ $message }}</div>
@enderror

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Password hash

A

First input -> use Illuminate/support/facades/hash

Hash::make(your password)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Authorization method

A

First input->use Illuminate/support/facades/Auth

Auth::attempt([
………
]);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Authorization Checking

Getting auth user

A

if( Auth::check( ) ){
$user = Auth::user( );
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Image File Name & File save

A

$file = $request->file(‘image’)
$fileName = rand() . $file->getClientOriginalName();
$file->move(public_path(‘filepath’),
$fileName)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Pagination

A

E.g $products = Product:paginate(3)

In blade file
{{ $products->links()}}

providers/AppServiceProvider
use Illuminate\Pagination\Paginator;

public function boot()
{
Paginator::useBootstrap();
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

sending data with compact

A
$user = User::all)
return view('index' , compact('user'));
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

error validation with custom message

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

number index in blade file

A

{{ $posts ->firstItem( ) + $loop ->index }}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

image intervention

A

in terminal
composer require intervention/image

Go to config/app.php
$providers
Intervention\Image\ImageServiceProvider::class;

$aliases
‘Image’ => Intervention\Image\Facades\Image::class

$ php artisan vendor:publish –provider=”Intervention\Image\ImageServiceProviderLaravelRecent”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

uploading multiple pics

A

multiple keyword should be used

foreach($image as $mult_img){

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly