Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f5b344
commit c6e3692
Showing
3 changed files
with
243 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php | ||
|
||
namespace App\Policies; | ||
|
||
use App\User; | ||
use Illuminate\Auth\Access\HandlesAuthorization; | ||
|
||
class stub | ||
{ | ||
use HandlesAuthorization; | ||
|
||
/** | ||
* Determine whether the user can view any models. | ||
* | ||
* @param \App\User $user | ||
* @return mixed | ||
*/ | ||
public function viewAny(User $user) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Determine whether the user can view the model. | ||
* | ||
* @param \App\User $user | ||
* @param \App\User $model | ||
* @return mixed | ||
*/ | ||
public function view(User $user, User $model) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Determine whether the user can create models. | ||
* | ||
* @param \App\User $user | ||
* @return mixed | ||
*/ | ||
public function create(User $user) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Determine whether the user can update the model. | ||
* | ||
* @param \App\User $user | ||
* @param \App\User $model | ||
* @return mixed | ||
*/ | ||
public function update(User $user, User $model) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Determine whether the user can delete the model. | ||
* | ||
* @param \App\User $user | ||
* @param \App\User $model | ||
* @return mixed | ||
*/ | ||
public function delete(User $user, User $model) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Determine whether the user can restore the model. | ||
* | ||
* @param \App\User $user | ||
* @param \App\User $model | ||
* @return mixed | ||
*/ | ||
public function restore(User $user, User $model) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Determine whether the user can permanently delete the model. | ||
* | ||
* @param \App\User $user | ||
* @param \App\User $model | ||
* @return mixed | ||
*/ | ||
public function forceDelete(User $user, User $model) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Determine whether the user can upload files. | ||
* | ||
* @param \App\User $user | ||
* @return mixed | ||
*/ | ||
public function uploadFiles(User $user) | ||
{ | ||
return true; | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
resources/js/spark-components/settings/profile/update-profile-photo.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
Vue.component('spark-update-profile-photo', { | ||
props: ['user'], | ||
|
||
/** | ||
* The component's data. | ||
*/ | ||
data() { | ||
return { | ||
form: new SparkForm({}) | ||
}; | ||
}, | ||
|
||
|
||
methods: { | ||
/** | ||
* Update the user's profile photo. | ||
*/ | ||
update(e) { | ||
e.preventDefault(); | ||
|
||
if ( ! this.$refs.photo.files.length) { | ||
return; | ||
} | ||
|
||
var self = this; | ||
|
||
this.form.startProcessing(); | ||
|
||
// Stream the file to S3 | ||
window.Vapor.store(this.$refs.photo.files[0], { | ||
progress: progress => { | ||
this.uploadProgress = Math.round(progress * 100); | ||
} | ||
}).then(response => { | ||
// Now we send details of the uploaded photo to the server. | ||
// We will update the user after this action. | ||
axios.post('/settings/photo',{ | ||
bucket: response.bucket, | ||
key: response.key, | ||
content_type: this.$refs.photo.files[0].type, | ||
}) | ||
.then( | ||
() => { | ||
Bus.$emit('updateUser'); | ||
|
||
self.form.finishProcessing(); | ||
}, | ||
(error) => { | ||
self.form.setErrors(error.response.data.errors); | ||
} | ||
); | ||
}); | ||
}, | ||
}, | ||
|
||
computed: { | ||
/** | ||
* Calculate the style attribute for the photo preview. | ||
*/ | ||
previewStyle() { | ||
return `background-image: url(${this.user.photo_url})`; | ||
} | ||
} | ||
|
||
}); |
74 changes: 74 additions & 0 deletions
74
resources/js/spark-components/settings/teams/update-team-photo.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
Vue.component('spark-update-team-photo', { | ||
props: ['user', 'team'], | ||
|
||
/** | ||
* The component's data. | ||
*/ | ||
data() { | ||
return { | ||
form: new SparkForm({}) | ||
}; | ||
}, | ||
|
||
|
||
methods: { | ||
/** | ||
* Update the user's profile photo. | ||
*/ | ||
update(e) { | ||
e.preventDefault(); | ||
|
||
if ( ! this.$refs.photo.files.length) { | ||
return; | ||
} | ||
|
||
var self = this; | ||
|
||
this.form.startProcessing(); | ||
|
||
// Stream the file to S3 | ||
window.Vapor.store(this.$refs.photo.files[0], { | ||
progress: progress => { | ||
this.uploadProgress = Math.round(progress * 100); | ||
} | ||
}).then(response => { | ||
// Now we send details of the uploaded photo to the server. | ||
// We will update the user after this action. | ||
axios.post(this.urlForUpdate,{ | ||
bucket: response.bucket, | ||
key: response.key, | ||
content_type: this.$refs.photo.files[0].type, | ||
}) | ||
.then( | ||
() => { | ||
Bus.$emit('updateTeam'); | ||
Bus.$emit('updateTeams'); | ||
|
||
self.form.finishProcessing(); | ||
}, | ||
(error) => { | ||
self.form.setErrors(error.response.data.errors); | ||
} | ||
); | ||
}); | ||
}, | ||
}, | ||
|
||
computed: { | ||
/** | ||
* Get the URL for updating the team photo. | ||
*/ | ||
urlForUpdate() { | ||
return `/settings/${Spark.teamsPrefix}/${this.team.id}/photo`; | ||
}, | ||
|
||
|
||
/** | ||
* Calculate the style attribute for the photo preview. | ||
*/ | ||
previewStyle() { | ||
return `background-image: url(${this.team.photo_url})`; | ||
} | ||
} | ||
|
||
}); |