Esempio n. 1
0
 /**
  * Responds to requests to GET /activities/edit
  */
 public function getEdit($id = null)
 {
     $activity = \App\Activity::with('activities_dow')->find($id);
     $groupModel = new \App\Group();
     $groups_for_dropdown = $groupModel->getGroupsForDropdown();
     # Get all the possible days so we can include them with check
     $days_for_this_activity = [];
     foreach ($activity->activities_dow as $dow) {
         $days_for_this_activity[] = $dow->day_of_week;
     }
     return view('activities.edit')->with(['activity' => $activity, 'groups_for_dropdown' => $groups_for_dropdown, 'days_for_checkbox' => $this->days_for_checkbox, 'days_for_this_activity' => $days_for_this_activity]);
 }
 public function createGroup(Request $request)
 {
     $name = $request->input('name');
     $description = $request->input('description');
     $password = $request->input('password');
     //------------------------
     $group = new \App\Group();
     $group->name = $name;
     $group->description = $description;
     $group->password = $password;
     $group->user_ids = "[" . auth()->user()->id . "]";
     $group->save();
     //redirect to the user's home page.........
     return redirect(url('/home'));
 }
 /**
  * Run the database seeds.
  */
 public function run()
 {
     $faker = Faker::create();
     // create 10 users
     DB::table('users')->delete();
     App\User::create(['email' => '*****@*****.**', 'password' => bcrypt('secret'), 'name' => $faker->name]);
     for ($i = 1; $i <= 10; ++$i) {
         App\User::create(['email' => $faker->safeEmail, 'password' => bcrypt('secret'), 'name' => $faker->name]);
     }
     // Groups, discussions and comments
     DB::table('groups')->delete();
     DB::table('membership')->delete();
     DB::table('discussions')->delete();
     DB::table('comments')->delete();
     for ($i = 1; $i <= 5; ++$i) {
         $group = App\Group::create(['name' => 'Group nr ' . $i, 'body' => $faker->text]);
         // attach one random member to each group
         $group->users()->attach(App\User::orderByRaw('RAND()')->first());
         // add 10 discussions to each group
         for ($j = 1; $j <= 10; ++$j) {
             $discussion = App\Discussion::create(['name' => $faker->city, 'body' => $faker->text]);
             // attach one random author & group to each discussion
             $discussion->user_id = App\User::orderByRaw('RAND()')->first()->id;
             $discussion->group_id = App\Group::orderByRaw('RAND()')->first()->id;
             $discussion->save();
             // Add 10 comments to each discussion
             for ($k = 1; $k <= 10; ++$k) {
                 $comment = new \App\Comment();
                 $comment->body = $faker->text;
                 $comment->user_id = App\User::orderByRaw('RAND()')->first()->id;
                 $discussion->comments()->save($comment);
             }
         }
     }
 }
Esempio n. 4
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     ///create admin role
     $group = App\Group::create(['name' => 'admin']);
     //create admin user
     $user = App\User::create(['name' => 'admin', 'password' => \Hash::make('password'), 'email' => '*****@*****.**']);
     //Create non admin user
     $user2 = App\User::create(['name' => 'user', 'password' => \Hash::make('password'), 'email' => '*****@*****.**']);
     //assign admin role to first user
     $user->assignGroup(1);
 }
Esempio n. 5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('groups')->delete();
     App\Group::create(['name' => 'Ανεξάρτητοι Έλληνες']);
     App\Group::create(['name' => 'Κ.Κ.Ε.']);
     App\Group::create(['name' => 'Ν.Δ.']);
     App\Group::create(['name' => 'ΠΑ.ΣΟ.Κ.']);
     App\Group::create(['name' => 'ΣΥΡΙΖΑ']);
     App\Group::create(['name' => 'Το Ποτάμι']);
     App\Group::create(['name' => 'Χρυσή Αυγή']);
 }
*/
/**
 * Particular routes
 */
Route::get('/', function () {
    return view('welcome');
});
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
Route::get('student/{id}.json', 'StudentController@toJson');
Route::get('group/{id}.json', 'GroupController@toJson');
Route::get('tutor/{nombre}.json', 'TutorController@toJson');
Route::get('inscription/{id}/print', 'InscriptionController@printdoc');
/**
 * Model routing
 */
Route::model('group', 'Group');
Route::bind('group', function ($value, $route) {
    return App\Group::findOrFail($value);
});
/**
 * Resources controllers
 */
Route::group(['middleware' => 'auth'], function () {
    Route::resource('school', 'SchoolController');
    Route::resource('schoolyear', 'SchoolyearController');
    Route::resource('subject', 'SubjectController');
    Route::resource('partial', 'PartialController');
    Route::resource('student', 'StudentController');
    Route::resource('group', 'GroupController');
    Route::resource('inscription', 'InscriptionController');
});
Esempio n. 7
0
 public function testNewbieCanJoinOpenGroup()
 {
     $group = App\Group::where('name', 'Test group')->first();
     $user = App\User::where('email', '*****@*****.**')->first();
     $this->actingAs($user)->visit('/groups/' . $group->id . '/join')->see('Join the group')->press('Join')->see('Welcome');
 }
Esempio n. 8
0
});
Route::bind('recipient', function ($id) {
    /** @var int $id */
    return App\Client::where('id', $id)->first();
});
Route::bind('event', function ($id) {
    /** @var int $id */
    return App\Event::where('id', $id)->first();
});
Route::bind('notice', function ($id) {
    /** @var int $id */
    return App\Notice::where('id', $id)->first();
});
Route::bind('group', function ($username) {
    /** @var int $id */
    return App\Group::where('username', $username)->first();
});
Route::bind('folder', function ($id) {
    /** @var int $id */
    return App\Folder::find($id);
});
Route::bind('file', function ($id) {
    /** @var int $id */
    return App\File::find($id);
});
Route::bind('code', function ($code) {
    /** @var int $code */
    return App\User::where('code', $code)->first();
});
/**Route::bind('school' , function($school)
{
Esempio n. 9
0
 /**
  * Create a new group
  * @method createGroup
  * @return [type]     [description]
  */
 public function createGroup()
 {
     return App\Group::create(['name' => 'Test Group', 'description' => 'Test Group']);
 }
Esempio n. 10
0
?>
 ">
                            <a href="javascript:;" class="nav-link nav-toggle">
                                <i class="icon-layers"></i>
                                <span class="title">Tickets</span>
                                <span class="arrow"></span>
                            </a>
                            <ul class="sub-menu">
                                <li class="nav-item  ">
                                    <a href="{{ url('/tickets/upload') }}" class="nav-link ">
                                        <span class="title"><i class="icon-cloud-upload"></i> Upload</span>
                                    </a>
                                </li>
                      
                                <?php 
$groups = App\Group::where('active', 1)->orderBy('name')->get();
?>

                                @foreach( $groups as $group )
                                <li class="nav-item  ">
                                    <a href="javascript:;" class="nav-link ">
                                        <span class="title"><i class="icon-list"></i> {{$group->name}}</span> <span class="arrow"></span>
                                    </a>
                                        <ul class="sub-menu">
                                            <li class="nav-item">
                                                <a href="{{ url('/tickets/ssd?q='.$group->name.'&status=1') }}" class="nav-link">
                                                    <i class="icon-pin"></i> New <span class="badge badge-danger">{{ App\Ticket::countStatus($group->name, 1) }}</span> 
                                                </a>
                                            </li>
                                            <li class="nav-item">
                                                <a href="{{ url('/tickets/ssd?q='.$group->name.'&status=2') }}" class="nav-link">
Esempio n. 11
0
 public function createGroupItem()
 {
     $dataArr = ['sorter' => 99, 'show' => true, 'stringfields' => [], 'textfields' => [], 'numbs' => [], 'bools' => [], 'images' => []];
     $blockname = $this->name;
     $groupstruct = config('sitestruct')[$this->name]['group'];
     $newGroupItem = new \App\Group();
     $newGroupItem->block_name = $blockname;
     $newGroupItem->save();
     $dataArr['id'] = $newGroupItem->id;
     if (array_key_exists('stringfields', $groupstruct)) {
         foreach ($groupstruct['stringfields'] as $fieldname) {
             $stringfield = Stringfield::create(['block_name' => $blockname, 'name' => $fieldname, 'group_id' => $newGroupItem->id]);
             $newGroupItem->stringfields()->save($stringfield);
             $dataArr['stringfields'][$fieldname] = '';
         }
     }
     if (array_key_exists('textfields', $groupstruct)) {
         foreach ($groupstruct['textfields'] as $fieldname) {
             $textfield = Textfield::firstOrNew(['block_name' => $blockname, 'name' => $fieldname, 'group_id' => $newGroupItem->id]);
             $newGroupItem->textfields()->save($textfield);
             $dataArr['textfields'][$fieldname] = '';
         }
     }
     if (array_key_exists('numbs', $groupstruct)) {
         foreach ($groupstruct['numbs'] as $fieldname) {
             $numb = Numb::firstOrNew(['block_name' => $blockname, 'name' => $fieldname, 'group_id' => $newGroupItem->id]);
             $newGroupItem->numbs()->save($numb);
             $dataArr['numbs'][$fieldname] = '';
         }
     }
     if (array_key_exists('bools', $groupstruct)) {
         foreach ($groupstruct['bools'] as $fieldname) {
             $boolitem = Bool::firstOrNew(['block_name' => $blockname, 'name' => $fieldname, 'group_id' => $newGroupItem->id]);
             $newGroupItem->bools()->save($boolitem);
             $dataArr['bools'][$fieldname] = '';
         }
     }
     if (array_key_exists('images', $groupstruct)) {
         foreach ($groupstruct['images'] as $fieldname) {
             $image = Imageitem::firstOrNew(['block_name' => $blockname, 'name' => $fieldname, 'group_id' => $newGroupItem->id]);
             $newGroupItem->images()->save($image);
             $dataArr['images'][$fieldname] = ['alt' => '', 'primary_link' => '', 'secondary_link' => '', 'icon_link' => '', 'preview_link' => ''];
         }
     }
     $newGroupItem->save();
     return $dataArr;
 }