Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
5860e1b7
Commit
5860e1b7
authored
Oct 26, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Plain Diff
Fixing merge conflicts
parents
81f878ae
994a3656
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
216 additions
and
194 deletions
+216
-194
BaseSidebarViewComposer.php
Modules/Core/Composers/BaseSidebarViewComposer.php
+16
-0
InstallCommand.php
Modules/Core/Console/InstallCommand.php
+168
-175
Authentication.php
Modules/Core/Contracts/Authentication.php
+7
-0
sidebar-nav.blade.php
Modules/Core/Resources/views/partials/sidebar-nav.blade.php
+25
-19
No files found.
Modules/Core/Composers/BaseSidebarViewComposer.php
0 → 100644
View file @
5860e1b7
<?php
namespace
Modules\Core\Composers
;
use
Modules\Core\Contracts\Authentication
;
abstract
class
BaseSidebarViewComposer
{
/**
* @var Authentication
*/
protected
$auth
;
public
function
__construct
(
Authentication
$auth
)
{
$this
->
auth
=
$auth
;
}
}
Modules/Core/Console/InstallCommand.php
View file @
5860e1b7
...
@@ -8,68 +8,68 @@ use Modules\User\Repositories\UserRepository;
...
@@ -8,68 +8,68 @@ use Modules\User\Repositories\UserRepository;
class
InstallCommand
extends
Command
class
InstallCommand
extends
Command
{
{
/**
/**
* The console command name.
* The console command name.
*
*
* @var string
* @var string
*/
*/
protected
$name
=
'platform:install'
;
protected
$name
=
'platform:install'
;
/**
/**
* The console command description.
* The console command description.
*
*
* @var string
* @var string
*/
*/
protected
$description
=
'Install the Platform CMS'
;
protected
$description
=
'Install the Platform CMS'
;
/**
/**
* @var UserRepository
* @var UserRepository
*/
*/
private
$user
;
private
$user
;
/**
/**
* @var Filesystem
* @var Filesystem
*/
*/
private
$finder
;
private
$finder
;
/**
/**
* Create a new command instance.
* Create a new command instance.
*
*
* @param UserRepository $user
* @param UserRepository $user
* @param Filesystem $finder
* @param Filesystem $finder
* @return \Modules\Core\Console\InstallCommand
* @return \Modules\Core\Console\InstallCommand
*/
*/
public
function
__construct
(
$user
,
Filesystem
$finder
)
public
function
__construct
(
$user
,
Filesystem
$finder
)
{
{
parent
::
__construct
();
parent
::
__construct
();
$this
->
user
=
$user
;
$this
->
user
=
$user
;
$this
->
finder
=
$finder
;
$this
->
finder
=
$finder
;
}
}
/**
/**
* Execute the actions
* Execute the actions
*
*
* @return mixed
* @return mixed
*/
*/
public
function
fire
()
public
function
fire
()
{
{
$this
->
info
(
'Starting the installation process...'
);
$this
->
info
(
'Starting the installation process...'
);
$this
->
configureDatabase
();
$this
->
configureDatabase
();
if
(
$this
->
confirm
(
'Do you wish to init sentinel and create its first user? [yes|no]'
))
{
if
(
$this
->
confirm
(
'Do you wish to init sentinel and create its first user? [yes|no]'
))
{
$this
->
runUserCommands
();
$this
->
runUserCommands
();
}
}
$this
->
runMigrations
();
$this
->
runMigrations
();
$this
->
publishAssets
();
$this
->
publishAssets
();
$this
->
blockMessage
(
$this
->
blockMessage
(
'Success!'
,
'Success!'
,
'Platform ready! You can now login with your username and password at /backend'
'Platform ready! You can now login with your username and password at /backend'
);
);
}
}
/**
/**
*
*
...
@@ -83,140 +83,133 @@ class InstallCommand extends Command
...
@@ -83,140 +83,133 @@ class InstallCommand extends Command
$this
->
info
(
'User commands done.'
);
$this
->
info
(
'User commands done.'
);
}
}
/**
/**
* Create the first user that'll have admin access
* Create the first user that'll have admin access
*/
*/
private
function
createFirstUser
()
private
function
createFirstUser
()
{
{
$this
->
line
(
'Creating an Admin user account...'
);
$this
->
line
(
'Creating an Admin user account...'
);
$firstname
=
$this
->
ask
(
'Enter your first name'
);
$firstname
=
$this
->
ask
(
'Enter your first name'
);
$lastname
=
$this
->
ask
(
'Enter your last name'
);
$lastname
=
$this
->
ask
(
'Enter your last name'
);
$email
=
$this
->
ask
(
'Enter your email address'
);
$email
=
$this
->
ask
(
'Enter your email address'
);
$password
=
$this
->
secret
(
'Enter a password'
);
$password
=
$this
->
secret
(
'Enter a password'
);
$userInfo
=
[
$userInfo
=
[
'first_name'
=>
$firstname
,
'first_name'
=>
$firstname
,
'last_name'
=>
$lastname
,
'last_name'
=>
$lastname
,
'email'
=>
$email
,
'email'
=>
$email
,
'password'
=>
Hash
::
make
(
$password
),
'password'
=>
Hash
::
make
(
$password
),
];
];
$this
->
user
->
createWithRoles
(
$userInfo
,
[
'admin'
]);
$this
->
user
->
createWithRoles
(
$userInfo
,
[
'admin'
]);
$this
->
info
(
'Admin account created!'
);
$this
->
info
(
'Admin account created!'
);
}
}
/**
/**
* Run migrations specific to Sentinel
* Run migrations specific to Sentinel
*/
*/
private
function
runSentinelMigrations
()
private
function
runSentinelMigrations
()
{
{
$this
->
call
(
'migrate'
,
[
'--package'
=>
'cartalyst/sentinel'
]);
$this
->
call
(
'migrate'
,
[
'--package'
=>
'cartalyst/sentinel'
]);
}
}
/**
/**
* Run the migrations
* Run the migrations
*/
*/
private
function
runMigrations
()
private
function
runMigrations
()
{
{
$this
->
call
(
'module:migrate'
,
[
'module'
=>
'Setting'
]);
$this
->
call
(
'module:migrate'
,
[
'module'
=>
'Setting'
]);
$this
->
info
(
'Application migrated!'
);
$this
->
info
(
'Application migrated!'
);
}
}
private
function
runUserSeeds
()
private
function
runUserSeeds
()
{
{
$this
->
call
(
'module:seed'
,
[
'module'
=>
'User'
]);
$this
->
call
(
'module:seed'
,
[
'module'
=>
'User'
]);
}
}
/**
/**
* Run the seeds
* Symfony style block messages
*/
* @param $title
private
function
runSeeds
()
* @param $message
{
* @param string $style
$this
->
info
(
'Application seeded!'
);
*/
}
protected
function
blockMessage
(
$title
,
$message
,
$style
=
'info'
)
{
/**
$formatter
=
$this
->
getHelperSet
()
->
get
(
'formatter'
);
* Symfony style block messages
$errorMessages
=
[
$title
,
$message
];
* @param $title
$formattedBlock
=
$formatter
->
formatBlock
(
$errorMessages
,
$style
,
true
);
* @param $message
$this
->
line
(
$formattedBlock
);
* @param string $style
}
*/
protected
function
blockMessage
(
$title
,
$message
,
$style
=
'info'
)
/**
{
* Publish the CMS assets
$formatter
=
$this
->
getHelperSet
()
->
get
(
'formatter'
);
*/
$errorMessages
=
[
$title
,
$message
];
private
function
publishAssets
()
$formattedBlock
=
$formatter
->
formatBlock
(
$errorMessages
,
$style
,
true
);
{
$this
->
line
(
$formattedBlock
);
$this
->
call
(
'module:publish'
,
[
'module'
=>
'Core'
]);
}
}
/**
/**
* Publish the CMS assets
* Configuring the database information
*/
*/
private
function
publishAssets
()
private
function
configureDatabase
()
{
{
$this
->
call
(
'module:publish'
,
[
'module'
=>
'Core'
]);
// Ask for credentials
}
$databaseName
=
$this
->
ask
(
'Enter your database name'
);
$databaseUsername
=
$this
->
ask
(
'Enter your database username'
);
/**
$databasePassword
=
$this
->
secret
(
'Enter your database password'
);
* Configuring the database information
*/
$this
->
setLaravelConfiguration
(
$databaseName
,
$databaseUsername
,
$databasePassword
);
private
function
configureDatabase
()
$this
->
configureEnvironmentFile
(
$databaseName
,
$databaseUsername
,
$databasePassword
);
{
}
// Ask for credentials
$databaseName
=
$this
->
ask
(
'Enter your database name'
);
/**
$databaseUsername
=
$this
->
ask
(
'Enter your database username'
);
* Writing the environment file
$databasePassword
=
$this
->
secret
(
'Enter your database password'
);
* @param $databaseName
* @param $databaseUsername
$this
->
setLaravelConfiguration
(
$databaseName
,
$databaseUsername
,
$databasePassword
);
* @param $databasePassword
$this
->
configureEnvironmentFile
(
$databaseName
,
$databaseUsername
,
$databasePassword
);
*/
}
private
function
configureEnvironmentFile
(
$databaseName
,
$databaseUsername
,
$databasePassword
)
{
/**
Dotenv
::
makeMutable
();
* Writing the environment file
* @param $databaseName
$environmentFile
=
$this
->
finder
->
get
(
'.env.example'
);
* @param $databaseUsername
* @param $databasePassword
$search
=
[
*/
"DB_USERNAME=homestead"
,
private
function
configureEnvironmentFile
(
$databaseName
,
$databaseUsername
,
$databasePassword
)
"DB_PASSWORD=homestead"
{
];
Dotenv
::
makeMutable
();
$replace
=
[
$environmentFile
=
$this
->
finder
->
get
(
'.env.example'
);
"DB_USERNAME=
$databaseUsername
"
,
"DB_PASSWORD=
$databasePassword
"
.
PHP_EOL
$search
=
[
];
"DB_USERNAME=homestead"
,
$newEnvironmentFile
=
str_replace
(
$search
,
$replace
,
$environmentFile
);
"DB_PASSWORD=homestead"
$newEnvironmentFile
.=
"DB_NAME=
$databaseName
"
;
];
// Write the new environment file
$this
->
finder
->
put
(
'.env'
,
$newEnvironmentFile
);
// Delete the old environment file
$this
->
finder
->
delete
(
'env.example'
);
$this
->
info
(
'Environment file written'
);
Dotenv
::
makeImmutable
();
}
/**
* Set DB credentials to laravel config
* @param $databaseName
* @param $databaseUsername
* @param $databasePassword
*/
private
function
setLaravelConfiguration
(
$databaseName
,
$databaseUsername
,
$databasePassword
)
{
$this
->
laravel
[
'config'
][
'database.connections.mysql.database'
]
=
$databaseName
;
$this
->
laravel
[
'config'
][
'database.connections.mysql.username'
]
=
$databaseUsername
;
$this
->
laravel
[
'config'
][
'database.connections.mysql.password'
]
=
$databasePassword
;
}
$replace
=
[
"DB_USERNAME=
$databaseUsername
"
,
"DB_PASSWORD=
$databasePassword
"
.
PHP_EOL
];
$newEnvironmentFile
=
str_replace
(
$search
,
$replace
,
$environmentFile
);
$newEnvironmentFile
.=
"DB_NAME=
$databaseName
"
;
// Write the new environment file
$this
->
finder
->
put
(
'.env'
,
$newEnvironmentFile
);
// Delete the old environment file
$this
->
finder
->
delete
(
'env.example'
);
$this
->
info
(
'Environment file written'
);
Dotenv
::
makeImmutable
();
}
/**
* Set DB credentials to laravel config
* @param $databaseName
* @param $databaseUsername
* @param $databasePassword
*/
private
function
setLaravelConfiguration
(
$databaseName
,
$databaseUsername
,
$databasePassword
)
{
$this
->
laravel
[
'config'
][
'database.connections.mysql.database'
]
=
$databaseName
;
$this
->
laravel
[
'config'
][
'database.connections.mysql.username'
]
=
$databaseUsername
;
$this
->
laravel
[
'config'
][
'database.connections.mysql.password'
]
=
$databasePassword
;
}
}
}
Modules/Core/Contracts/Authentication.php
View file @
5860e1b7
...
@@ -61,4 +61,11 @@ interface Authentication
...
@@ -61,4 +61,11 @@ interface Authentication
* @return bool
* @return bool
*/
*/
public
function
completeResetPassword
(
$user
,
$code
,
$password
);
public
function
completeResetPassword
(
$user
,
$code
,
$password
);
/**
* Determines if the current user has access to given permission
* @param $permission
* @return bool
*/
public
function
hasAccess
(
$permission
);
}
}
Modules/Core/Resources/views/partials/sidebar-nav.blade.php
View file @
5860e1b7
...
@@ -6,26 +6,32 @@
...
@@ -6,26 +6,32 @@
<?php
$items
=
\Modules\Core\Navigation\NavigationOrdener
::
order
(
$items
);
?>
<?php
$items
=
\Modules\Core\Navigation\NavigationOrdener
::
order
(
$items
);
?>
<?php
foreach
(
$items
as
$i
=>
$item
)
:
?>
<?php
foreach
(
$items
as
$i
=>
$item
)
:
?>
<?php
if
(
is_object
(
$item
))
:
?>
<?php
if
(
is_object
(
$item
))
:
?>
<li
class=
"treeview {{ $item[0]['request'] ? 'active' : ''}}"
>
<?php
if
(
$item
[
0
][
'permission'
])
:
?>
<a
href=
"#"
>
<li
class=
"treeview {{ $item[0]['request'] ? 'active' : ''}}"
>
<i
class=
"{{ $item[0]['icon-class'] }}"
></i>
<span>
{{ $item[0]['title'] }}
</span>
<a
href=
"#"
>
<i
class=
"fa fa-angle-left pull-right"
></i>
<i
class=
"{{ $item[0]['icon-class'] }}"
></i>
<span>
{{ $item[0]['title'] }}
</span>
</a>
<i
class=
"fa fa-angle-left pull-right"
></i>
<?php
$item
->
shift
();
?>
</a>
<ul
class=
"treeview-menu"
>
<?php
$item
->
shift
();
?>
<?php
foreach
(
$item
as
$subItem
)
:
?>
<ul
class=
"treeview-menu"
>
<li
class=
"{{ Request::is($subItem['request']) ? 'active' : ''}}"
>
<?php
foreach
(
$item
as
$subItem
)
:
?>
<a
href=
"{{ URL::route($subItem['route']) }}"
><i
class=
"{{$subItem['icon-class']}}"
></i>
{{ $subItem['title'] }}
</a>
<?php
if
(
$subItem
[
'permission'
])
:
?>
</li>
<li
class=
"{{ Request::is($subItem['request']) ? 'active' : ''}}"
>
<?php
endforeach
;
?>
<a
href=
"{{ URL::route($subItem['route']) }}"
><i
class=
"{{$subItem['icon-class']}}"
></i>
{{ $subItem['title'] }}
</a>
</ul>
</li>
</li>
<?php
endif
;
?>
<?php
endforeach
;
?>
</ul>
</li>
<?php
endif
;
?>
<?php
else
:
?>
<?php
else
:
?>
<li
class=
"{{ Request::is($item['request']) ? 'active' : ''}}"
>
<?php
if
(
$item
[
'permission'
])
:
?>
<a
href=
"{{ URL::route($item['route']) }}"
>
<li
class=
"{{ Request::is($item['request']) ? 'active' : ''}}"
>
<i
class=
"{{ $item['icon-class'] }}"
></i>
<span>
{{ $item['title'] }}
</span>
<a
href=
"{{ URL::route($item['route']) }}"
>
</a>
<i
class=
"{{ $item['icon-class'] }}"
></i>
<span>
{{ $item['title'] }}
</span>
</li>
</a>
</li>
<?php
endif
;
?>
<?php
endif
;
?>
<?php
endif
;
?>
<?php
endforeach
;
?>
<?php
endforeach
;
?>
</ul>
</ul>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment