bookshop's Introduction
bookshop's People
bookshop's Issues
Search LIKE
Berods ieškoti turi būti LIKE su % %, t.y. 'like', '%'.$search.'%'
Order find shorter
Vietoj
$order = Order::with('user')->where('id', $request->input('order_id'))->latest()->first();
Trumpiau:
$order = Order::with('user')->find($request->input('order_id'));
collect() nereikia
Galiu klysti, bet ir be collect()
veiks, nes ->get()
jau grąžina kolekciją
validated override?
Keistokas sprendimas. Jeigu, kaip suprantu, reikėjo tiesiog kad adminui būtų approved = 1, tai reikėjo controlleryje padaryti tą paprasčiau negu čia Laravel internals overridinti.
Pvz:
$data = $request->validated();
$data['approved'] = auth()->user()->admin;
users ir books
bookshop/app/Models/Review.php
Line 14 in 020d7e6
Naming dalykas - belongsTo funkcija turi vadintis vienaskaita: user() ir book()
test issue
test
Nereikia user_id ir id
bookshop/app/Models/Review.php
Line 16 in 020d7e6
Automatiškai tuos laukus paima, nereikia tų parametrų
abort_unless
-
Aš tai nemėgstu asmeniškai šitų atvirkščių sąlygų.
Rašyčiauabort_if(xxx, 403)
-
Taip pat nereikia
auth()->user()->id
, trumpiauauth()->id()
Nereikia scopeNewest
Line 56 in 020d7e6
Laravel Eloquent turi du priešingus metodus tam: latest()
kuris daro "order by created_at desc" ir oldest()
darantis "order by created_at asc".
whereBookId nerekomenduočiau
Tai yra "cool", bet nerekomenduojama daryti dėl skaitomumo ir vėiau sunku automatinius testus potencialiai parašyti.
Geriau paprastai ->where('book_id', X)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.