93 cards across 6 sections
whereVectorSimilarTo
PreventRequestForgery
Queue::route()
#[Middleware]
#[Authorize]
AsVector
insertOrIgnoreReturning
routes/web.php
routes/api.php
Route::get('/users', [UserController::class, 'index'])
{id}
->where('id', '[0-9]+')
whereNumber
whereUuid
function show(Post $post)
->name('posts.show')
route('posts.show', $post)
Route::middleware(['auth'])->prefix('admin')->group(...)
Route::resource('posts', PostController::class)
apiResource
$this->app->bind(Interface::class, Impl::class)
$this->app->singleton(...)
register()
boot()
Cache::get()
$this->app->when(...)->needs(...)->give(...)
Post
posts
id
created_at
updated_at
hasOne
hasMany
belongsTo
belongsToMany
hasManyThrough
Post::with('author')->get()
scopePublished(Builder $query)
Post::published()->get()
protected function price(): Attribute
$casts
array
php artisan make:migration
up()
down()
php artisan migrate
php artisan db:seed
$fillable
create()
update()
$guarded
$request->validate([...])
Validator
required
email
unique:users
php artisan make:request
rules()
authorize()
ValidationRule
validate()
handle($request, Closure $next)
bootstrap/app.php
web
api
terminate()
throttle:60,1
ShouldQueue
php artisan make:job
handle()
ProcessPodcast::dispatch($podcast)
->delay(now()->addMinutes(10))
Bus::batch([...])->then()->catch()->finally()->dispatch()
#[Tries(3)]
public $tries = 3
failed_jobs
php artisan queue:retry
Event::dispatch(new OrderShipped($order))
middleware()
WithoutOverlapping
RateLimited
Gate::define('update-post', fn ($user, $post) => $user->id === $post->user_id)
Gate::allows()
php artisan make:policy PostPolicy --model=Post
update($user, $post)
$this->authorize('update', $post)
@if
@foreach
@auth
@include
resources/views/components
<x-alert type="error">Msg</x-alert>
@extends('layouts.app')
@section
@yield
{{ $slot }}
{{ $value }}
htmlspecialchars
{!! $value !!}
php artisan make:model
make:controller
make:migration
php artisan make:command
signature
php artisan tinker
tests/Feature
tests/Unit
$this->get('/posts')->assertOk()
assertJson()
RefreshDatabase
Post::factory()->create()
Queue::fake()
Event::fake()
Http::fake()
Mail::fake()
with()
Model::preventLazyLoading()
$posts = Post::with('author', 'comments')->get();foreach ($posts as $post) { echo $post->author->name;}
Cache::remember(key, ttl, closure)
$posts = Cache::remember('posts', 3600, function () { return Post::published()->get();});
chunk()
lazy()
Post::chunk(200, function ($posts) { foreach ($posts as $post) { // process $post }});
FormRequest
public function store(StorePostRequest $r) { Post::create($r->validated());}
Route::resource('users.posts', PostController::class)->scoped()
Route::resource('users.posts', PostController::class) ->scoped();
RateLimiter::for('api', function ($request) { return Limit::perMinute(60) ->by($request->user()?->id);});
Http::fake([ 'api.example.com/*' => Http::response(['ok'=>true]),]);
SendWelcomeEmail::dispatch($user) ->onQueue('emails');
DB::transaction()
DB::transaction(function () use ($order, $items) { $order->save(); $order->items()->createMany($items);});
$guarded = []
protected $fillable = ['title', 'body', 'slug'];
protected $casts = [ 'status' => OrderStatus::class,];
__invoke
class PublishPost { public function __invoke(Post $post) { $post->update(['published' => true]); }}
ShouldBroadcast
class OrderShipped implements ShouldBroadcast { public function broadcastOn() { return new Channel('orders'); }}
php artisan make:resource
return PostResource::collection( Post::paginate(15));
Log::error()
Log::error('Payment failed', [ 'order_id' => $order->id, 'gateway' => $gateway,]);
update
delete
@can
php artisan queue:work
findOrFail()
assertPushed
assertSent
$post->author->name
with('author')
is_admin
paginate()
$this->authorize()
Authorize
config('services.stripe.key')
.env
php artisan config:cache
Hash
hashed
queue:work
.gitignore
.env.example
@csrf