Completed
Push — master ( c7d5ad...0208a8 )
by Sherif
02:59
created

SampelReport::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 22
rs 9.2
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6
class SampelReport extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
{
8
	/**
9
	 * Run the migrations.
10
	 *
11
	 * @return void
12
	 */
13
	public function up()
14
	{
15
		DB::statement( "DROP VIEW IF EXISTS admin_count");
16
		DB::statement( "CREATE VIEW admin_count AS  
17
			select count(u.id)
18
			from users u, groups g ,users_groups ug
19
			where
20
			ug.user_id  = u.id and
21
			ug.group_id = g.id 
22
			");
23
		
24
		DB::table('reports')->insert(
25
        	[
26
	        	[
27
				'report_name' => 'admin_count',
28
				'view_name'   => 'admin_count',
29
				'created_at'  => \DB::raw('NOW()'),
30
				'updated_at'  => \DB::raw('NOW()')
31
	        	]
32
        	]
33
        );
34
	}
35
36
	/**
37
	 * Reverse the migrations.
38
	 *
39
	 * @return void
40
	 */
41
	public function down()
42
	{
43
		// 
44
	}
45
}