بنقرة واحدة
laravel
Laravel v12 - The PHP Framework For Web Artisans
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Laravel v12 - The PHP Framework For Web Artisans
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Transparent, rigorous research with full methodology — not a black-box API wrapper. Conducts exhaustive investigation through mandated 2-cycle research per theme, APA 7th citations, evidence hierarchy, and 3 user checkpoints. Self-contained using native OpenClaw tools (web_search, web_fetch, sessions_spawn). Use for literature reviews, competitive intelligence, or any research requiring academic rigor and reproducibility.
Monitor Hacker News, Reddit, and arXiv for AI agent developments and trending topics. Use when the user wants a summary of recent AI agent news, needs to search for specific research papers, or wants to set up automated news digests in heartbeats.
This skill enables comprehensive control and inspection of the Chrome browser without extensions, utilizing the Chrome DevTools Protocol via chrome-devtools-mcp. Use it for advanced browser automation, performance analysis, debugging network requests, taking screenshots, and interacting with web pages. Triggers include explicit requests to browse, automate, debug, or analyze Chrome's behavior, or any task requiring headless/direct browser interaction.
Access real-time cryptocurrency market data including prices, market cap, and global stats via CoinLore API. Use when the user asks for crypto prices, market rankings, or global crypto stats. No API key required.
Debug running Docker containers and Compose services. Use when inspecting container logs, exec-ing into running containers, diagnosing networking issues, checking resource usage, debugging multi-stage builds, troubleshooting health checks, or fixing Compose service dependencies.
Convert between fiat and cryptocurrencies using daily updated exchange rates from the currency-api. Use when the user needs currency conversion or current exchange rates. No API key required.
| name | laravel |
| description | Laravel v12 - The PHP Framework For Web Artisans |
Comprehensive assistance with Laravel 12.x development, including routing, Eloquent ORM, migrations, authentication, API development, and modern PHP patterns.
This skill should be triggered when:
// Basic routes
Route::get('/users', [UserController::class, 'index']);
Route::post('/users', [UserController::class, 'store']);
// Route parameters
Route::get('/users/{id}', function ($id) {
return User::find($id);
});
// Named routes
Route::get('/profile', ProfileController::class)->name('profile');
// Route groups with middleware
Route::middleware(['auth'])->group(function () {
Route::get('/dashboard', [DashboardController::class, 'index']);
Route::resource('posts', PostController::class);
});
// Define a model with relationships
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Post extends Model
{
protected $fillable = ['title', 'content', 'user_id'];
protected $casts = [
'published_at' => 'datetime',
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function comments(): HasMany
{
return $this->hasMany(Comment::class);
}
}
// Create a migration
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('posts', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->string('title');
$table->text('content');
$table->timestamp('published_at')->nullable();
$table->timestamps();
$table->index(['user_id', 'published_at']);
});
}
public function down(): void
{
Schema::dropIfExists('posts');
}
};
// Controller validation
public function store(Request $request)
{
$validated = $request->validate([
'title' => 'required|max:255',
'content' => 'required',
'email' => 'required|email|unique:users',
'tags' => 'array|min:1',
'tags.*' => 'string|max:50',
]);
return Post::create($validated);
}
// Form Request validation
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StorePostRequest extends FormRequest
{
public function rules(): array
{
return [
'title' => 'required|max:255',
'content' => 'required|min:100',
];
}
}
// Common query patterns
// Eager loading to avoid N+1 queries
$posts = Post::with(['user', 'comments'])
->where('published_at', '<=', now())
->orderBy('published_at', 'desc')
->paginate(15);
// Conditional queries
$query = Post::query();
if ($request->has('search')) {
$query->where('title', 'like', "%{$request->search}%");
}
if ($request->has('author')) {
$query->whereHas('user', function ($q) use ($request) {
$q->where('name', $request->author);
});
}
$posts = $query->get();
namespace App\Http\Controllers\Api;
use App\Models\Post;
use App\Http\Resources\PostResource;
use Illuminate\Http\Request;
class PostController extends Controller
{
public function index()
{
return PostResource::collection(
Post::with('user')->latest()->paginate()
);
}
public function store(Request $request)
{
$post = Post::create($request->validated());
return new PostResource($post);
}
public function show(Post $post)
{
return new PostResource($post->load('user', 'comments'));
}
public function update(Request $request, Post $post)
{
$post->update($request->validated());
return new PostResource($post);
}
}
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class PostResource extends JsonResource
{
public function toArray($request): array
{
return [
'id' => $this->id,
'title' => $this->title,
'slug' => $this->slug,
'excerpt' => $this->excerpt,
'content' => $this->when($request->routeIs('posts.show'), $this->content),
'author' => new UserResource($this->whenLoaded('user')),
'comments_count' => $this->when($this->comments_count, $this->comments_count),
'published_at' => $this->published_at?->toISOString(),
'created_at' => $this->created_at->toISOString(),
];
}
}
// API token authentication setup
// In config/sanctum.php - configure stateful domains
// Issue tokens
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens;
}
// Login endpoint
public function login(Request $request)
{
$credentials = $request->validate([
'email' => 'required|email',
'password' => 'required',
]);
if (!Auth::attempt($credentials)) {
return response()->json(['message' => 'Invalid credentials'], 401);
}
$token = $request->user()->createToken('api-token')->plainTextToken;
return response()->json(['token' => $token]);
}
// Protect routes
Route::middleware('auth:sanctum')->group(function () {
Route::get('/user', fn(Request $r) => $r->user());
});
// Create a job
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class ProcessVideo implements ShouldQueue
{
use InteractsWithQueue, Queueable;
public function __construct(
public Video $video
) {}
public function handle(): void
{
// Process the video
$this->video->process();
}
}
// Dispatch jobs
ProcessVideo::dispatch($video);
ProcessVideo::dispatch($video)->onQueue('videos')->delay(now()->addMinutes(5));
// Bind services in AppServiceProvider
use App\Services\PaymentService;
public function register(): void
{
$this->app->singleton(PaymentService::class, function ($app) {
return new PaymentService(
config('services.stripe.secret')
);
});
}
// Use dependency injection in controllers
public function __construct(
protected PaymentService $payment
) {}
public function charge(Request $request)
{
return $this->payment->charge(
$request->user(),
$request->amount
);
}
This skill includes comprehensive documentation in references/:
Use the reference files for detailed information about:
Laravel follows the Model-View-Controller pattern:
Laravel's powerful database abstraction layer:
with()Define application endpoints:
{id} and optional {id?}Filter HTTP requests:
Laravel's dependency injection container:
Laravel's CLI tool:
php artisan make:model Post -mcr # Create model, migration, controller, resource
php artisan migrate # Run migrations
php artisan db:seed # Seed database
php artisan queue:work # Process queue jobs
php artisan optimize:clear # Clear all caches
Start with:
routes/web.phpphp artisan make:controllerFocus on:
Explore:
php artisan route:list to view all registered routesphp artisan tinker for interactive debugginginterface PostRepositoryInterface
{
public function all();
public function find(int $id);
public function create(array $data);
}
class PostRepository implements PostRepositoryInterface
{
public function all()
{
return Post::with('user')->latest()->get();
}
public function find(int $id)
{
return Post::with('user', 'comments')->findOrFail($id);
}
}
class CreatePost
{
public function execute(array $data): Post
{
return DB::transaction(function () use ($data) {
$post = Post::create($data);
$post->tags()->attach($data['tag_ids']);
event(new PostCreated($post));
return $post;
});
}
}
class Post extends Model
{
public function scopePublished($query)
{
return $query->where('published_at', '<=', now());
}
public function scopeByAuthor($query, User $user)
{
return $query->where('user_id', $user->id);
}
}
// Usage
Post::published()->byAuthor($user)->get();