Instance | Branch |
---|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE AdventureWorks2012; | |
GO | |
CREATE SCHEMA [stg] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*This will create new table 'newTableNameToBeCreated' with same structure as 'myRealTable' */ | |
/* no data will be inserted into the new table */ | |
SELECT * | |
into newTableNameToBeCreated | |
FROM myRealTable | |
where 0=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use [SALES] | |
/*This returns approximate count*/ | |
EXEC sp_spaceused N'dbo.Customers'; | |
GO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Exemples : | |
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}"> | |
- Or, request confirmation in the process - | |
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?"> | |
*/ | |
(function() { | |
Send data with $http.post() in AngularJs
In AngularJs Controller
....
var config = {
headers : {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
Laravel - Eloquent - query many to many relationship
Example:
Table 1: posts
Table 2: categories
Pivot Table: category_post with foreign keys category_id, post_id
If you are using intervention in laravel for image resize then below snippet you can use to resize with max width and max height and maintaing aspect ration.
$img = Image::make($file);
$new_filename = 'newname.'.$file->getClientOriginalExtension();
$img->widen(660, function($constraint){
$constraint->upsize(); //this makes sure no upsize
})->heighten(330, function($constraint){
$constraint->upsize(); //this constraint makes sure no upsize
Following should work if you want to use try/catch for FindOrFail
use Illuminate\Database\Eloquent\ModelNotFoundException;
...
try {
$current = Promovote::where('module_id',$data['module'])->firstOrFail($id);
} catch (ModelNotFoundException $ex) {
// Error handling code
}
NewerOlder