本文整理汇总了PHP中Action::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::create方法的具体用法?PHP Action::create怎么用?PHP Action::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action
的用法示例。
在下文中一共展示了Action::create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
* POST /actions
*
* @return Response
*/
public function store()
{
$response = new stdClass();
$statusCode = 201;
$in = Input::only('tid', 'created_at');
$rules = array('tid' => 'required | integer');
$vd = Validator::make($in, $rules);
if ($vd->fails()) {
$errs = $vd->messages();
$statusCode = 400;
$response = $errs->all();
} else {
$authId = Auth::user()->id;
// 先檢查是否在 Target 有登記
$uid = Target::where(array('id' => $in['tid'], 'uid' => $authId))->pluck('uid');
// 取得使用者的教會
$cid = UserChurch::where(array('uid' => $authId))->pluck('cid');
if ($uid == $authId) {
$in['uid'] = Auth::user()->id;
$in['cid'] = $cid;
$action = Action::create($in);
if ($in['created_at']) {
$in['created_at'] = Carbon::createFromTimeStamp($in['created_at'], 'Asia/Taipei')->toDateTimeString();
$action->setCreatedAt($in['created_at']);
$action->save();
}
} else {
$statusCode = 403;
}
}
return Response::json($response, $statusCode);
}
示例2: run
public function run()
{
#DB::table('groups')->truncate();
Group::create(array('name' => 'developer', 'desc' => 'Разработчики', 'dashboard' => 'admin'));
Group::create(array('name' => 'admin', 'desc' => 'Администраторы', 'dashboard' => 'admin'));
Group::create(array('name' => 'moderator', 'desc' => 'Модераторы', 'dashboard' => 'admin'));
## SELECT CONCAT("['module' => '", module, "', 'action' => '", action, "'],") FROM `actions` WHERE 1
$actions = [['module' => 'dictionaries', 'action' => 'view'], ['module' => 'dictionaries', 'action' => 'create'], ['module' => 'dictionaries', 'action' => 'edit'], ['module' => 'dictionaries', 'action' => 'delete'], ['module' => 'dictionaries', 'action' => 'dicval_view'], ['module' => 'dictionaries', 'action' => 'dicval_create'], ['module' => 'dictionaries', 'action' => 'dicval_edit'], ['module' => 'dictionaries', 'action' => 'dicval_delete'], ['module' => 'dictionaries', 'action' => 'dicval_restore'], ['module' => 'dictionaries', 'action' => 'settings'], ['module' => 'dictionaries', 'action' => 'dicval_entity_view'], ['module' => 'dictionaries', 'action' => 'hidden'], ['module' => 'dictionaries', 'action' => 'import'], ['module' => 'galleries', 'action' => 'view'], ['module' => 'galleries', 'action' => 'create'], ['module' => 'galleries', 'action' => 'edit'], ['module' => 'galleries', 'action' => 'delete'], ['module' => 'pages', 'action' => 'view'], ['module' => 'pages', 'action' => 'create'], ['module' => 'pages', 'action' => 'edit'], ['module' => 'pages', 'action' => 'delete'], ['module' => 'pages', 'action' => 'advanced'], ['module' => 'pages', 'action' => 'page_restore'], ['module' => 'seo', 'action' => 'edit'], ['module' => 'system', 'action' => 'system'], ['module' => 'system', 'action' => 'settings'], ['module' => 'system', 'action' => 'modules'], ['module' => 'system', 'action' => 'groups'], ['module' => 'system', 'action' => 'users'], ['module' => 'system', 'action' => 'locale_editor']];
if (isset($actions) && is_array($actions) && count($actions)) {
foreach ($actions as $act) {
if (!is_array($act) || !isset($act['module']) || !$act['module'] || !isset($act['action']) || !$act['action']) {
continue;
}
Action::create(array('group_id' => '1', 'module' => $act['module'], 'action' => $act['action'], 'status' => '1'));
}
}
}
示例3: run
public function run()
{
#DB::table('groups')->truncate();
Group::create(array('name' => 'developer', 'desc' => 'Разработчики', 'dashboard' => 'admin'));
Group::create(array('name' => 'admin', 'desc' => 'Администраторы', 'dashboard' => 'admin'));
Group::create(array('name' => 'doctors', 'desc' => 'Доктора', 'dashboard' => 'doctors'));
## SELECT CONCAT("['module' => '", module, "', 'action' => '", action, "'],") FROM `actions` WHERE 1
$actions = [['module' => 'system', 'action' => 'system'], ['module' => 'system', 'action' => 'settings'], ['module' => 'system', 'action' => 'modules'], ['module' => 'system', 'action' => 'groups'], ['module' => 'system', 'action' => 'users'], ['module' => 'system', 'action' => 'locale_editor']];
if (isset($actions) && is_array($actions) && count($actions)) {
foreach ($actions as $act) {
if (!is_array($act) || !isset($act['module']) || !$act['module'] || !isset($act['action']) || !$act['action']) {
continue;
}
Action::create(array('group_id' => '1', 'module' => $act['module'], 'action' => $act['action'], 'status' => '1'));
}
}
}
示例4: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
// $this->call('UserTableSeeder');
DB::table('log_types')->delete();
LogType::create(array('name' => 'Inicio de sesión'));
LogType::create(array('name' => 'Cierre de sesión'));
LogType::create(array('name' => 'Registro/Creación'));
LogType::create(array('name' => 'Edición'));
LogType::create(array('name' => 'Eliminación/Cancelación/Inhabilitación'));
LogType::create(array('name' => 'Habilitación'));
LogType::create(array('name' => 'Subida de documento al servidor'));
LogType::create(array('name' => 'Eliminación de documento del servidor'));
LogType::create(array('name' => 'Descarga de documento'));
LogType::create(array('name' => 'Error de permisos'));
DB::table('users')->delete();
$user_webmaster = User::create(array('dni' => '73128679', 'email' => 'diego200039@hotmail.com', 'password' => Hash::make('12345678')));
$user_director = User::create(array('dni' => '22222222', 'email' => '', 'password' => Hash::make('12345678')));
DB::table('teachers')->delete();
$director = Teacher::create(array('names' => 'Julia', 'lastname' => 'Malpartida Llanos', 'state' => 'A', 'birthdate' => date('Y-m-d', strtotime('1960-07-20')), 'user_id' => $user_director->id));
DB::table('profiles')->delete();
$prof_webmaster = Profile::create(array('name' => 'webmaster', 'description' => 'Administrador del sitio'));
$prof_director = Profile::create(array('name' => 'Director', 'description' => ''));
$prof_tutor = Profile::create(array('name' => 'Tutor', 'description' => ''));
$prof_profesor = Profile::create(array('name' => 'Profesor', 'description' => ''));
$prof_administrativo = Profile::create(array('name' => 'Personal Administrativo', 'description' => ''));
$prof_alumno = Profile::create(array('name' => 'Alumno', 'description' => ''));
DB::table('actions')->delete();
$nav_anho_escolar = Action::create(array('name' => 'nav_anho_escolar', 'description' => ''));
$side_nuevo_anho_escolar = Action::create(array('name' => 'side_nuevo_anho_escolar', 'description' => ''));
$side_listar_anhos_escolares = Action::create(array('name' => 'side_listar_anhos_escolares', 'description' => ''));
$nav_matricula = Action::create(array('name' => 'nav_matricula', 'description' => ''));
$side_aprobar_pre_inscripciones = Action::create(array('name' => 'side_aprobar_pre_inscripciones', 'description' => ''));
$side_aprobar_matriculas_online = Action::create(array('name' => 'side_aprobar_matriculas_online', 'description' => ''));
$side_matricula_offline = Action::create(array('name' => 'side_matricula_offline', 'description' => ''));
$side_subir_lista_utiles = Action::create(array('name' => 'side_subir_lista_utiles', 'description' => ''));
$side_matricularse = Action::create(array('name' => 'side_matricularse', 'description' => ''));
$side_mis_matriculas = Action::create(array('name' => 'side_mis_matriculas', 'description' => ''));
$nav_niveles_cursos = Action::create(array('name' => 'nav_niveles_cursos', 'description' => ''));
$side_nuevo_nivel = Action::create(array('name' => 'side_nuevo_nivel', 'description' => ''));
$side_listar_niveles = Action::create(array('name' => 'side_listar_niveles', 'description' => ''));
/*$nav_cursos = Action::create(array(
'name' => 'nav_cursos',
'description' => ''
));*/
$side_nuevo_curso = Action::create(array('name' => 'side_nuevo_curso', 'description' => ''));
/*$side_listar_cursos = Action::create(array(
'name' => 'side_listar_cursos',
'description' => ''
));*/
$side_armar_horario = Action::create(array('name' => 'side_armar_horario', 'description' => ''));
$nav_horarios = Action::create(array('name' => 'nav_horarios', 'description' => ''));
$side_mi_horario = Action::create(array('name' => 'side_mi_horario', 'description' => ''));
$nav_tareas = Action::create(array('name' => 'nav_tareas', 'description' => ''));
$side_nueva_tarea = Action::create(array('name' => 'side_nueva_tarea', 'description' => ''));
$side_ver_tareas = Action::create(array('name' => 'side_ver_tareas', 'description' => ''));
// EL TUTOR PUEDE VER LAS TAREAS DE TODOS LOS CURSOS DE SU NIVEL
$side_mis_tareas = Action::create(array('name' => 'side_mis_tareas', 'description' => ''));
$nav_notas = Action::create(array('name' => 'nav_notas', 'description' => ''));
$side_registrar_notas = Action::create(array('name' => 'side_registrar_notas', 'description' => ''));
$side_ver_notas = Action::create(array('name' => 'side_ver_notas', 'description' => ''));
// EL TUTOR PUEDE VER LAS NOTAS DE TODOS LOS CURSOS DE SU NIVEL
$side_mis_notas = Action::create(array('name' => 'side_mis_notas', 'description' => ''));
$nav_personas = Action::create(array('name' => 'nav_personas', 'description' => ''));
$side_nuevo_alumno = Action::create(array('name' => 'side_nuevo_alumno', 'description' => ''));
$side_listar_alumnos = Action::create(array('name' => 'side_listar_alumnos', 'description' => ''));
$side_nuevo_profesor = Action::create(array('name' => 'side_nuevo_profesor', 'description' => ''));
$side_listar_profesores = Action::create(array('name' => 'side_listar_profesores', 'description' => ''));
$side_nuevo_personal_administrativo = Action::create(array('name' => 'side_nuevo_personal_administrativo', 'description' => ''));
$side_listar_personal_administrativo = Action::create(array('name' => 'side_listar_personal_administrativo', 'description' => ''));
$nav_libreta_control = Action::create(array('name' => 'nav_libreta_control', 'description' => ''));
$side_nueva_anotacion = Action::create(array('name' => 'side_nueva_anotacion', 'description' => ''));
$side_ver_anotaciones = Action::create(array('name' => 'side_ver_anotaciones', 'description' => ''));
$side_mis_anotaciones = Action::create(array('name' => 'side_mis_anotaciones', 'description' => ''));
$nav_comunicados = Action::create(array('name' => 'nav_comunicados', 'description' => ''));
$side_nuevo_comunicado = Action::create(array('name' => 'side_nuevo_comunicado', 'description' => ''));
$side_ver_comunicados = Action::create(array('name' => 'side_ver_comunicados', 'description' => ''));
$nav_usuarios = Action::create(array('name' => 'nav_usuarios', 'description' => ''));
/*$side_nuevo_usuario = Action::create(array(
'name' => 'side_nuevo_usuario',
'description' => ''
));*/
$side_listar_usuarios = Action::create(array('name' => 'side_listar_usuarios', 'description' => ''));
$nav_sistema = Action::create(array('name' => 'nav_sistema', 'description' => ''));
/*$side_nuevo_perfil = Action::create(array(
'name' => 'side_nuevo_perfil',
'description' => ''
));*/
$side_listar_perfiles = Action::create(array('name' => 'side_listar_perfiles', 'description' => ''));
$side_reporte_log = Action::create(array('name' => 'side_reporte_log', 'description' => ''));
DB::table('profile_actions')->delete();
$prof_webmaster->actions()->attach($nav_anho_escolar->id);
$prof_webmaster->actions()->attach($side_nuevo_anho_escolar->id);
$prof_webmaster->actions()->attach($side_listar_anhos_escolares->id);
$prof_webmaster->actions()->attach($nav_matricula->id);
//.........这里部分代码省略.........