來源:https://notestore.cn/laravel-...laravel
use Illuminate\Support\Facades\DB;
DB::table("?")->where('字段名', 條件值)->where('字段名',條件值)->where('字段名',條件值)->whereIn('字段名',[1,2])->orderBy('字段名','ASC')->select('字段名1','字段名2','字段名3','字段名4')->groupBy('字段名')->skip(0)->take(20)->get();
DB::table('?')->insert(["字段名" => 字段值,"字段名" => 字段值]);
DB::table('?')->where(["字段名" => 字段值,"字段名" => 字段值])->update(["字段名" => 字段值,"字段名" => 字段值]);
DB::table('?')->where(['字段名' => 字段值,'字段名' => 字段值,'字段名' => 字段值,'字段名' => 字段值])->first(['字段名1','字段名2']);
id
DB::table('?')->insertGetId(["字段名" => 字段值,"字段名" => 字段值]);
DB::table('?1')->whereIn('?1.字段名',[值,值])->where([['?1.字段名','<>',值],['?1.字段名','=',字段值],['?1.字段名','=',字段值]])->where(function ($query) { $query->where('?2.status','=',字段值)->orWhere('?1.字段名','=','字段值'); })->where(function ($query) use (變量值) { $query->where('?2.字段名','like',變量值. '%')->orWhere('?1.字段名', 'like','%' . 變量值. '%')->orWhere('?3.字段名', 'like',變量值. '%'); })->leftJoin('?2','?2.字段名', '=', '?1.字段名')->leftJoin('?3','?3.字段名', '=', '?1.字段名')->orderBy('?2.字段名','ASC')->orderBy('?2.字段名','ASC')->orderBy('?3.字段名','ASC')->select('?1.字段名','?2.字段名','?2.字段名','?1.字段名','?1.字段名 as 字段名')->groupBy('?1.字段名')->skip(0)->take(20) ->get();
use Illuminate\Http\Request;
$language = $request->get('language');
use Illuminate\Support\Facades\Cache;
Cache::has("緩存名")
Cache::get("緩存名");
Cache::forever("緩存名","緩存值");
Cache::forget("緩存名");
Cache::put("緩存名","緩存值",Carbon::parse(date("Y-m-d H:i:s",過時時間戳)));
use Illuminate\Support\Facades\Crypt;
Crypt::decrypt(待解密內容);
Crypt::encrypt(待加密內容);
use Illuminate\Support\Carbon;