database
-
Add column to table in Laravel
Create migration in console: Use Schema::table() to access existing table (instead of Schema::create() for creating new tables) Then run migrations:
-
Laravel helpful plugins
Generate Seed from Databasehttps://github.com/orangehill/iseed Generate Migrations from Database:https://github.com/Xethron/migrations-generator
-
(MySQL) MySQL doodles
[sql] — Replace a word or string in a column UPDATE my_table SET my_column = REPLACE(my_column, ‘Old string’, ‘New string’); — [/sql]
-
Get a list of run database queries in Laravel
This is great if you want to see what queries are actually run when using Eloquent.
-
Convert CSV to SQL
This tool is fantastic! It saved me many hours of work, when I had complex CSV files I needed to turn into SQL tables http://www.convertcsv.com/csv-to-sql.htm
-
(PHP) Eloquent doodles for Laravel
[php] // Get model by primary key $myModel = MyModel::find($id); //Where can use short syntax for equal comparison. $myModels = MyModel::where(‘someAttribute’, ‘=’, ‘someValue’)->get(); $myModels = MyModel::where(‘someAttribute’, ‘someValue’)->get(); // Delete models $affectedRows = MyModel::where(‘someAttribute’, ‘someValue’)->delete(); // Select distinct $distincts = MyModel::distinct()->select(‘someAttribute’)->where(‘someAttribute’, ‘someValue’)->get(); // Select with Limit and offset $myModels = MyModel::limit(30)->get(); $myModels = MyModel::limit(30)->offset(30)->get(); [/php] Different…