Search the Community
Showing results for tags 'laravel'.
-
//my controller <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use DB; class homeController extends Controller { public function index() { $employee = DB::table('employee')->orderBy('id','desc')->get(); $department = DB::table('department')->orderBy('id','desc')->get(); return view('index', ['employee' => $employee , 'department' => $department]); } } //my routes Route::get('index','homeController@index'); //my view using blade temmplating engine @foreach($employee as $emp) <div class="employee"> <b>{{ $emp->name }} </b> <a href="employee/{{ $emp->id }}"> <p class="intro">{{ substr($emp->intro ,0, 50) }}...</p> </a> </div> @endforeach @foreach($department as $dep) <div class="department"> <b>{{ $dep->name }} </b> <a href="department/{{ $dep->id }}"> <p class="desc">{{ substr($dep->description ,0, 100) }}...</p> </a> </div> @endforeach I want to fetch using ajax, how can i do it, teach/help me
-
I have this code: class DropzoneController extends Controller { public function __construct() { $this->middleware('auth'); if (!Auth::check()) { return redirect('auth/login'); } $this->user = Auth::user(); } public function index() { return view('dropzone_demo'); } public function uploadFiles() { $message="Profile Image Created"; $input = Input::all(); $rules = array( 'file' => 'image|max:3000', ); $validation = Validator::make($input, $rules); if ($validation->fails()) { return Response::make($validation->errors->first(), 400); } $destinationPath = 'uploads'; // upload path: public/uploads $extension = Input::file('file')->getClientOriginalExtension(); // getting file extension $fileName = rand(11111, 99999) . '.' . $extension; // renameing image $upload_success = Input::file('file')->move($destinationPath, $fileName); // uploading file to given path if ($upload_success) { return Response::json('success', 200); } else { return Response::json('error', 400); } // attaching the profile image to the authenticated user. $user->profileImage()->create([ 'filename' => $filename ]); Session::flash('new_profile_image', 'Profile Photo Updated!'); } public function authorize($ability, $arguments = Array) { // set to true instead of false return true; } } The error occurs for this line: public function authorize($ability, $arguments = Array) and it says: syntax error, unexpected ')', expecting '(' Not sure what that means. Anyone who can tell me what the issue is?
-
I am getting this error: syntax error, unexpected '}' @extends('layouts.master') @section('scripts') <script type="text/javascript" src="{!! asset('js/status.min.js') !!}"></script> @stop @section('content') {!! csrf_field() !!} @if (count($errors) > 0) <div class="alert alert-danger"> <strong>Whoops!</strong> There were some problems with your input.<br><br> <ul> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif <!-- Using laravel session --> @if(Session::has('message')) <!-- Checking if session has a variable called message. --> <div class="alert alert-info"> <li> {{ Session::get('message') }} </li> <!--if true -print the message from the insert_posts variable. --> </div> @endif {{-- You have a $user variable available representing the current Auth::user(); --}} <p>Hello, {{ $user->name }}.</p> {{-- This user has a profile whose properties you can also display --}} <p>Goals: {{ $user->profile->goals }}</p> {{-- You can also drill down to the profile's expectations --}} <p>Expectations</p> <ul class="profile-list"> @foreach($user->profile->expectations as $expectation) <li class="profile-list-item">{!! $expectation->name !!}</li> @endforeach </ul> <p><b> this is other users you may want to follow: </br></p> <ul> @foreach($mutuals as $mutual) <!-- hub/{{$mutual->user->id}} It goes to the user that matches the value of $mutual criteria. and then it goes and gets its id.This is sent to the controller for further handling.Check page source to see id's numbers. --> <!-- In the href - Passing the user to your controller --> <br><li><a href="{{URL::to('hub', [$mutual->user->id])}}" class="button button-3d" name="make_follow">Follow User</a> {!! $mutual->user->name; !!} <!-- I access the user's name property --> </li> @endforeach </ul> <form action="{{ route('createPost') }}" method="post"> <!--the form action is the method in a route called createPost --> @if(isset($message)) <!-- if the var exist and have a value it would be printed. It is used for all the notifications in this page.--> {{ $message }} @endif <br> <!-- only when a post has been submitted the varible value will show. --> <!-- telling the form the info go to this route (url). almost equal form action ="samePage" --> {!! Form::hidden('post') !!} {!! csrf_field() !!} <div class=contentWrap> <div class="test" placeholder="How's your fitness going?..." contenteditable="true"></div> </div> <div class=icons> <img alt="heart" src="http://icons.iconarchive.com/icons/succodesign/love-is-in-the-web/512/heart-icon.png"> </div> <button> Post to profile </button> <div class="errors"> </div> </form> <!-- script to check if user typed anything in the textbox before submit. both .text() and .html() return strings. It's testing if the string length is zero. trim is for removing whitespaces before and after a string. the 'submit' event is needed since it's a submit button. --> <div class="own_posts"> <p> here are your latest posts:</p> <!-- I think I should create foreach loop to iterate over each post and show it here. --> </div> <br><br> <div class="following_posts"> <p> Posts from people you're following: <p> <!-- Iterate over the followee's posts with a foreach loop: the first parameter the foreach gets is the array expression. Second element: On each iteration, the value of the current element (which is a post) is assigned to $value (second element) and the internal array pointer is advanced by one. Next: within these: {{!! !!}} --> @foreach ($get_followee_posts as $post) <form action="/html/tags/html_form_tag_action.cfm" method="post"> <textarea name="comments" id="comments" style="width:96%;height:90px;background-color:white;color:black;border:none;padding:2%;font:22px/30px sans-serif;"> {!! $post->full_post !!} </textarea> </form> @endforeach </div> @stop I tried with 2 editors and netbeans to figure why. I also use blade syntax of laravel.
-
Hi I’m trying to develop an online application that will allow ‘Candidates’ to book on courses that “Providers” have posted. The application is going to have 4 different types of users, please see attached ‘Figure 1.4 - JobSkilla User Permissions & Roles.jpg’ all of which have different information associated with them. On first signup of a provider they will complete a company profile and a user will be created as the owner associated with that “Provider” that user will then be able to invite their team members (Team associations) to share the same “Provider” data but with restricted access to areas such as billing / invoives. I’m going to be building the application using laravel 5.2, I still want to use laravels Auth but how can I allow multiple auths? I was thinking of having a table called “Auth” that could manage the logins with a forging key to the ‘candidates’, ‘providers’ table. What’s the best way of handling multiple logins that are associated with 1 “Provider”? I’ve attached a EER diagram with the current database design this may be incomplete. I wanted to ask for some guidance with the best way to program/db design the project. I would appreciate if anyone can give me a better solution or point me in the right direction. I don't mind paying for advice. JobSkilla EER Diagram.pdf
-
I am trying to pick activityType and show the value in an array that looks like this: http://4.1m.yt/ukCLELP.png I want the activityType value to be an actual option like: option1,option2 etc.. But it throws an error instead (when trying to change values of it): ErrorException in c3b8369e5906a262c6e3760a4e5a65e9 line 35: Use of undefined constant Aerobics - assumed 'Aerobics' (View: /var/www/L53/resources/views/dashboard.blade.php) here's my relevant view code snippet: ) What do you expect from this app to help you? <br><br> (You can always change this later) <br><br>  {!! Form::checkbox('expectations','New anerobic routines'); !!} Find new anerobic routines <br>  {!! Form::checkbox('expectations','New aerobic routines'); !!} Find new aerobic routines <br>  {!! Form::checkbox('expectations','Follow'); !!} Follow other users to get inspired <br> <br><br> Thanks!
-
Hi all, I’m building a search engine to find courses online; I wanted to ask for some guidance with the best way to program/structure the project. I’m going to be building the application using laravel 5.2 I have 3 different types of users as follows Users Course Providers Advisors All of which have different information associated with them such as Users Table first_name last_name date_of_birth email password Course Providers – this needs to have multiple logins associated with the course provider company_name address_line_1 address_line_2 postcode tel Advisors company_name first_name last_name email password I still want to use laravels Auth but how can I allow multiple auths or am I best in using roles if so how would this work? What’s the best way of handling multiple logins that are associated with 1 company? I would appreciate if anyone can give me a better solution or point me in the right direction.
-
Hi all. No matter what i tried my links just wont work on my laravel app. My css folder is in the public folder. public/css. I dunno what is wrong. I installed laravel with composer and i am running windows 7 and wamp. this is the link i used: <link rel="stylesheet" href="{!! asset('css/bootstrap.min.css') !!}"> <link rel="stylesheet" href="{!! asset('css/styles.css') !!}"> Thanks
-
Hello, I installed composer and then I tried installing the laravel command line functions as it was described in their website, namely I ran this command: composer global require "laravel/installer=~1.1" Taken from directly from the official website - http://laravel.com/docs/4.2#install-laravel But when I run: laravel new blog I get an error: C:\xampp\htdocs>laravel new blog 'laravel' is not recognized as an internal or external command, operable program or batch file. Please help! I really want to use the "laravel" command lines from the CMD. I am on Windows 8.1. I searched a lot in Google for help but with no luck Many thanks!
-
Hi all. I have two tables. categories and products. On the create product page, I have a select dropdown field that I want to populate all the available categories. How can I archive that? This is what I did but I am having error: MY FORM <form> <select name="cat_name" > <option value="">Select One</option> @foreach($categories as $category) <option value="{{ $category->cat_name}}"> {{ $category->cat_name}} </option> @endforeach </form> MY CONTROLLER use App\Http\Controllers\ProductController; use App\Http\Controllers\CategoryController; public function create() { return view('products.create', [ $result = (new CategoryController)->Category() ]); } } Thanks
-
Hi there. I have posts, post comments and users tables which are all fine in and of themselves, but I'd like users to have a unique name that's specific only to the post to hide their real username. This applies to the post itself, and the comments of the post and must remain consistent. For example, if Bill made a post with the name "BigFish", if they comment on their own post then their comments will also have that same name. Likewise, if another user comments with the name "BowlingBall", their subsequent comments will also have the same name. Now, my first attempt was to have an intermediate table of sorts, containing the post_id, user_id and display_name. This takes the appearance of a composite primary key, which are not supported in Laravel. Laravel relationships of such nature can be achieved with a package called Compoships, which does work and given the nature of the table, their resulting query being a gigantic mess of the following is reasonable at best. (post_id == ? AND user_id == ?) OR (post_id == ? AND user_id == ?) OR ... However, that can quickly scale and definitely hurts. Another way to tackle it is to retrieve all display names for each post ID, but that's then retrieving unnecessary data. It's also possible to scrap the table, store the names in the posts and post_comments tables. That's as simple as checking if the commenter is the post author and use that name, or checking if they've previously commented and use that name. I'm not sure if that's ideal either. This brings me back here, after a decade of inactivity, and I do apologise for the lengthy post. How would I go about achieving what I want to do in the best way possible? What would you do in this scenario? Thanks in advance, looking forward to y'all suggestions.
-
Hello, i'm currently developing a website using laravel. I have added a 3 new columns for bravo_book_others table the columns are other_name, gender, and other_address. I have a case like this : User1 want to buy 4 holiday package for user1 friends, so user1 have to input 3 of user1 friends like this : Gender#1 : male Name#1 : a Email#1 : [email protected] Address#1 : a street Gender#2 : female Name#2 : b Email#2 : [email protected] Address#2 : b street Gender#3 : male Name#3 : c Email#3 : [email protected] Address#3 : c street I already done it with the email in the controller like this : foreach ($request->input('other_emails') as $email){ BookOther::create([ 'booking_id'=>$booking->id, 'user_id'=>$booking->customer_id, 'other_emails'=>$email ]); Mail::to($email)->send(new OthersEmail($isi_email1)); } How can i put the other_name, gender, and other_address and store it into the database?? The Model : class BookOther extends Model { use HasFactory; protected $table = 'bravo_book_others'; protected $fillable = [ 'booking_id', 'user_id', 'gender', 'other_name', 'other_address', 'other_emails' ]; public function booking(){ return $this->belongsTo('Modules\Booking\Models\Booking', 'booking_id', 'id'); } public function user(){ return $this->belongsTo('App\User', 'user_id', 'id'); } } The Controller : foreach ($request->input('other_emails') as $email){ BookOther::create([ 'booking_id'=>$booking->id, 'user_id'=>$booking->customer_id, 'other_emails'=>$email ]); Mail::to($email)->send(new OthersEmail($isi_email1)); }
-
RealPage in North Dallas is has 10 PHP Developer openings. All Direct Hire, No Remote. We are innovating from within and building our new generation of products, such as Rentjoy (http://www.realpage.com/realworld/ -watch Rentjoy Keynote – Dustin Gellman, our SVP Innovation Lab), ALL PHP. Ideally they would have Laravel experience but not required. RealPage is a growing SaaS and Cloud provider for the multifamily and rental industry with over 65 products. Job Desc: PHP Web Developer Job at RealPage, Inc. in Dallas/Fort Worth Area |https://www.linkedin.com/jobs/view/185472378 You can message me or you can apply online. Open to helping with relocation. John Laury [email protected]